~/talk

Dart Exceptions: Best Practices

Talkat Fluttercon USA 2025 · 2025-06-25..06-26· [developer-experience]
slides:none on file

Defines three Dart exception categories (Exception, Error, anything thrown) and recommends only catching Exceptions while letting Errors phone home to crash analytics like Firebase Crashlytics; prefers using rethrow or throwWithStackTrace when wrapping errors to preserve stacks. Advises async/await over chained futures, use typed onError instead of legacy catchError, place whenComplete immediately after future creation, enable very_good_analysis lints, and consider FP Dart’s Either.tryCatch to convert exceptions into values.

AI-written summary · about

  1. 0:00Introduction
  2. 1:06Exception categories
  3. 3:56Try-catch-finally syntax
  4. 5:43Catching exceptions
  5. 7:51Throwing errors
  6. 10:39Custom exception hierarchies
  7. 13:08Log and rethrow strategy
  8. 14:10Repackage and rethrow
  9. 16:40Clean stack traces
  10. 18:04Substitute values
  11. 19:28Lints for exceptions
  12. 22:38Unawaited futures
  13. 24:01Errors as state
  14. 25:28Either for error handling
  15. 28:17Top-level remote logging
  16. 29:42Async/await futures
  17. 31:50Complete and error handling
  18. 33:15Zones in handling
  19. 34:17Closing remarks
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.