Created with <3 with dartpad.dev.
Created
October 5, 2023 15:35
-
-
Save MelvinRB27/5e11c83dc7601dc818d0c59ca375054b to your computer and use it in GitHub Desktop.
future
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 main() { | |
httpGet("melvin").then((data) => { | |
print(data) | |
}).catchError((err) => { | |
print("error: $err") | |
}); | |
} | |
Future<String> httpGet(String url){ | |
return Future.delayed(Duration(seconds: 1), (){ | |
throw 'Error grabe'; | |
//return 'Respuesta del api existosa'; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment