ethicnology / dart-nostr

nostr library in dart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error handling

hazeycode opened this issue · comments

Currently assert is used to check that various things are valid. This is an incorrect use of assertions and makes this library unusable for any production code. Assertions should be used to check for programmer errors during development not normal runtime data errors.

In Dart, the proper way to handle normal runtime errors is by using Exceptions see https://dart.dev/language/error-handling

Exceptions in Dart are not ideal. It's better to use nullables or error unions. See discussion here: dart-lang/language#3094