Created
March 15, 2022 19:58
-
-
Save mennanov/44c2d4bf726fc3398329b7a72045a0ca to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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