Created
November 7, 2024 17:55
-
-
Save PlugFox/675bdaf8ae604989e1dc7959abddbfd5 to your computer and use it in GitHub Desktop.
Completer throws an error to the zone.
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
/* | |
* Completer throws an error to the zone. | |
* https://gist.github.com/PlugFox/675bdaf8ae604989e1dc7959abddbfd5 | |
* https://dartpad.dev?id=675bdaf8ae604989e1dc7959abddbfd5 | |
* Mike Matiunin <[email protected]>, 07 November 2024 | |
*/ | |
// ignore_for_file: cascade_invocations, avoid_print | |
import 'dart:async'; | |
void main() => runZonedGuarded<void>(() { | |
try { | |
final completer = Completer<void>(); | |
/* completer.future.ignore() */ | |
completer.completeError( | |
Exception('Fake error'), | |
StackTrace.empty, | |
); | |
} on Object { | |
print('Not happening'); | |
} | |
}, (error, stackTrace) { | |
print('Caught error: $error'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment