Skip to content

Instantly share code, notes, and snippets.

@MelvinRB27
Created October 5, 2023 15:47
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/585aa184c7eda59c91c0ab6dcad85915 to your computer and use it in GitHub Desktop.
Save MelvinRB27/585aa184c7eda59c91c0ab6dcad85915 to your computer and use it in GitHub Desktop.
try, catch
void main() async {
try {
final value = await httpGet("melvin");
print(value);
} catch (err) {
print('Error: $err');
}
}
Future<String> httpGet(String url) async {
await Future.delayed(Duration(seconds: 1));
//return 'Respuesta http';
throw 'Hubo un error';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment