You are viewing...

Dart's import_of_legacy_library_into_null_safe is annoying and how to disable it

Updated on December 27, 2020 at the 00th hour
Posted under:

DISCLAIMER: Expressed views on this blog are my own.

Flutter/Dart, whatever you want to associate null-safety with. Why is this lint error a thing? The official solution is to migrate the imported library. Lol, I don't believe it is my problem that the library is not "null safe".

This null safety change is just a syntactical sugar change. It moves all existing types to nullable opt-in. This assumes that all libraries are opted-in to nullable types while any libraries compiled with new dart versions are opted-out of nullable types by default.


For example, assume some class called Circle.

"Circle" from old dart becomes "Circle?" in new dart while "Circle" means non nullable. Why do I need to be warned about some library that is opted in to nullable types by default?

The solution specified in the linter is garbage. I should migrate it? Fuck you!


To turn this annoying warning off:

/analysis_options.yaml

analyzer:
errors:
import_of_legacy_library_into_null_safe: ignore
You just read "Dart's import_of_legacy_library_into_null_safe is annoying and how to disable it". Please share if you liked it!
You can read more recent posts here.