Last active
October 22, 2019 00:19
-
-
Save luizmarcus/87a09f67f204c9bb3aa8dc4788683622 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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