From this post, quoting Bob Nystrom:
Error and its subclasses are for programmatic errors. If one of those
occurs, your code is bad and you should fix your code.Non-Error exception classes are for runtime errors. Sometimes you can
prevent them from being thrown, but often you cannot.Except in a few special circumstances, idiomatic Dart should throw
Errors, but never catch them. They exists specifically to not be
caught so that they take down the app and alert the programmer to the
location of the bug.
In other words, you should expect (and check for) exceptions (it is intended that you should handle them). If you get an error, then you need to check how you’re using the API that’s throwing the error – you’re probably using it wrong.
If you’re writing an API, then you should use the same pattern. Errors are messages to downstream developers about how they are using your API.