Skip to content

Instantly share code, notes, and snippets.

Created April 9, 2020 19:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Future<bool> login(String usuario, String password) async {
setState(() {
cargandoBoton = true;
final http.Response response = await
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
body: jsonEncode(<String, String>{
'email': usuario,
'password': password,
setState(() {
this.cargandoBoton = false;
if (response.statusCode == 200) {
Map<String, dynamic> respuesta = json.decode(response.body);
var token = respuesta["access_token"];
await _guardarToken(token);
return true;
return false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment