Skip to content

Instantly share code, notes, and snippets.

@mennanov
Last active March 15, 2022 20:01
Show Gist options
  • Save mennanov/2f1696f02998c6bfadf2c5e615101c6c to your computer and use it in GitHub Desktop.
Save mennanov/2f1696f02998c6bfadf2c5e615101c6c to your computer and use it in GitHub Desktop.
import 'dart:async';
void main() async {
print('start');
try {
doSomething().then((e) {
print('e: $e');
});
} catch (e) {
print('caught exception: $e');
}
print('end');
}
Future<String> doSomething() async {
await Future.delayed(Duration(seconds: 1));
throw Exception('Exception!');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment