Skip to content

Instantly share code, notes, and snippets.

@nsmirosh
Last active August 17, 2020 20:14
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 nsmirosh/05bb8ae60c33c0428951f37e7d0e1bec to your computer and use it in GitHub Desktop.
Save nsmirosh/05bb8ae60c33c0428951f37e7d0e1bec to your computer and use it in GitHub Desktop.
Future error handling with the await
void main() async {
try {
await Future.delayed(Duration(seconds: 1), () => throw 'Boom!');
} catch (e) {
print('error we caught: $e');
} finally {
print('doing something regardless of what happened previously');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment