UC-Davis-molecular-computing / scadnano

Web application for designing DNA structures such as DNA origami.
https://scadnano.org
MIT License
21 stars 13 forks source link

migrate to Dart null safety mode #419

Open dave-doty opened 3 years ago

dave-doty commented 3 years ago

Dart null safety is coming soon. It will have stronger checks on types than older versions, in particular:

https://codewithandrea.com/articles/2020-06-22-implicit-downcast-no-longer-allowed/#disabling-implicit-downcasts-in-analysis_optionsyaml

We can enable those checks to be reported by the static analyzer in Dart 2.8, in analysis_options.yaml, by setting these two values to false:

analyzer:
  strong-mode:
    implicit-casts: false
    implicit-dynamic: false

Do this and then deal with the avalanche of type errors.

One annoying thing is that is requires every function/method to have a return type, even though I've been leaving it off for functions with a void return type. So there will be several hundred of these to correct.

dave-doty commented 3 months ago

We have been unable to implement this while OverReact did not support null safety. Now it does as of version 5.0.0: https://pub.dev/packages/over_react/changelog

dave-doty commented 3 months ago

There is a migration tool to help: https://dart.dev/null-safety/migration-guide#step3-analyze

dave-doty commented 3 months ago

See also https://medium.com/dartlang/gradual-null-safety-migration-for-large-dart-projects-85acb10b64a9