Skip to content

Instantly share code, notes, and snippets.

@nsmirosh
Last active August 17, 2020 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsmirosh/503185c6d3edaf1bf964ddaf81df9fa5 to your computer and use it in GitHub Desktop.
Save nsmirosh/503185c6d3edaf1bf964ddaf81df9fa5 to your computer and use it in GitHub Desktop.
Future error handling with catchError and whenComplete
void main() {
Future.delayed(Duration(seconds: 1), () => throw 'Boom!')
.catchError(
(e) => print('error we caught: $e'),
)
.whenComplete(() =>
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