LeastAuthority / destiny

Destiny – Cross-platform Magic Wormhole graphical client
MIT License
236 stars 13 forks source link

Assert usage in dart code #211

Open donpui opened 1 year ago

donpui commented 1 year ago

We have several places where we use assert in dart flutter code: https://github.com/LeastAuthority/destiny/blob/cdc4b6964b74eba6a6ab3a079161b9212eba8a49/lib/views/shared/file_picker.dart#L107

All asserts: https://github.com/LeastAuthority/destiny/search?q=assert%28

If file is not selected (User cancel selection file), so this statement becomes false: assert(result?.files.length == 1);

image

Not fully sure if we should use here assert and just rewrite exception handling.

To may understanding, we have not enabled asserts in release mode.