Skip to content

Instantly share code, notes, and snippets.

@mennanov
Created March 15, 2022 19:58
Show Gist options
  • Save mennanov/44c2d4bf726fc3398329b7a72045a0ca to your computer and use it in GitHub Desktop.
Save mennanov/44c2d4bf726fc3398329b7a72045a0ca to your computer and use it in GitHub Desktop.
import 'dart:async';
void main() async {
print('start');
try {
doSomething().then((e) {
print('e: $e');
}).catchError((e) {
print('catchError: $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