sdk
sdk copied to clipboard
Analyzer Feedback from IntelliJ
Version information
IDEA AI-233.14808.21.2331.118421043.4.3AI-233.14808.21.2331.11842104, JRE 17.0.10+0-17.0.10b1087.21-11572160x64 JetBrains s.r.o., OS Mac OS X(x86_64) v13.6.6, screens 1920.0x1080.0
Analyzer is not showing the suggestion of error solving in the whole file like in second screenshot.
Summary: The IntelliJ Dart analyzer is not providing error resolution suggestions for the entire file, despite the presence of errors. This issue prevents users from efficiently fixing errors in their code.
If i wanted to add null safety in whole file then i have to add manually as dart does not support migration in other versions. Dart analyzer should provide this feature to solve errors effectively.
Doing manually error solving for same time of errros is very hard for large projects.
If i wanted to add null safety in whole file then i have to add manually as dart does not support migration in other versions.
In versions of the SDK before 3.0 (when non-nullable by default became the only option) there was a migration tool specifically targeted at this kind of migration. If you can go back to an earlier version to do the migration, that might be the easiest path forward. (We can't support the migration tool in 3.0 because the tools no longer understand pre 2.12 code.)
Doing manually error solving for same time of errros is very hard for large projects.
Yes it is.
The reasons we don't currently support this operation across multiple locations within the same file are:
-
Adding a null check changes the type of the expression in ways that can cause other null-related diagnostics to appear or disappear. There's no guarantee that adding a null check operator in some given location would still be necessary or appropriate after adding a null check operator somewhere else.
-
Add a null check operator is rarely the right way to solve the problem, so you really ought to be looking at each site individually to decide whether there might be a better way to solve the problem. One reason why it's not usually the right solution is because it converts a compile-time error into a run-time error, and run-time errors tend to be harder to find and fix.
I'm not sure we'd want to enable this fix for broad use across a file because of those reasons.
Thanks for the valuable feedback. What I did to migrate null safety
- Followed the steps to migrate to null safety. [2.10.5 to 3.7.12 flutter version]
- Migrated to drift database from moor.
- Still migration errors as well as some null safety errors in the project [dart analyzer didn't solve null safety in project, they solved some part of files.].
- Downgraded again but now i am facing an error of drift errors as well as null safety compilation errors, Due to that i can't migrate to null safety against those files are pending to migrate to null safety.
- So i used
dart migrate --skip-import-check --ignore-errorsto ignore errors but migration can't apply for those file.