Last active
August 17, 2020 20:14
-
-
Save nsmirosh/05bb8ae60c33c0428951f37e7d0e1bec to your computer and use it in GitHub Desktop.
Future error handling with the await
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() 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