Skip to content

Instantly share code, notes, and snippets.

@MelvinRB27
Created October 5, 2023 15:35
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 MelvinRB27/5e11c83dc7601dc818d0c59ca375054b to your computer and use it in GitHub Desktop.
Save MelvinRB27/5e11c83dc7601dc818d0c59ca375054b to your computer and use it in GitHub Desktop.
future
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