Skip to content

Instantly share code, notes, and snippets.

@luizmarcus
Last active October 22, 2019 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luizmarcus/87a09f67f204c9bb3aa8dc4788683622 to your computer and use it in GitHub Desktop.
Save luizmarcus/87a09f67f204c9bb3aa8dc4788683622 to your computer and use it in GitHub Desktop.
void getProfile() async {
Response response = await _dio.get("/users/$_count");
var profile = response.data["data"];
setState(() {
_nome = profile['first_name'] + " " + profile['last_name'];
_email = profile['email'];
_avatar = NetworkImage(profile['avatar']);
});
}
void submitUser() async {
Response response =
await _dio.post("/users", data: {"name": _nome, "job": _job.text});
setState(() {
_nome = "Nome do Usuário";
_email = "Email do Usuário";
_avatar = NetworkImage("https://via.placeholder.com/100");
_job.text = "";
_result = response.data.toString();
_count++;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment