i have an old Flutter project. In it i have this error part 'Target of URI hasn't been generated: 'MoorDatabase.g.dart'.Try running the generator that will generate the file referenced by the URI.
. So i used this command flutter pub run build_runner build
. But it shows me this error Bad state: Unexpected diagnostics: C:\flutter\bin\cache\dart-sdk\lib\internal\internal.dart:691:16 - This requires the 'non-nullable' language feature to be enabled.[SEVERE] floor_generator:floor_generator on test/bloc/report_bloc_test.dart:
. How can i fix it?
What have i already done:
- i used
flutter pub upgrade
command and it upgraded some of the dependencies. 88 packages have newer versions incompatible with dependency constraints. I tried to update all the dependencies manually, but most of them were incompatible with each other - tried to sync project in Android Studio and restart dart analytics
- cleared cache and re-downloaded dependencies
CodePudding user response:
This problem was occured for me after upgrading the Flutter. I solved it by cleaning and upgrading the project dependencies again. Run the below commands in the root directory of your project:
flutter clean
flutter packages pub upgrade
flutter pub run build_runner build
Also as others said, please make sure your sdk version in the pubspec.yaml is compatible with your flutter sdk version.
Also, sdk verision should be at least sdk: ">=2.12.0 <3.0.0" for that syntax
CodePudding user response:
Error was fixed by changing sdk version and manually updating all the dependencies, with fixing compatibility issues