Reputation: 4918
I checked and the file is OK.
Dart 1.23.0 AngularDart 3.1.0
The error I am getting is:
Target of URI hasn't been generated: 'file.g.dart'
Upvotes: 11
Views: 10788
Reputation: 163
you want to add this dependency and try it again.
dart pub add freezed
dart pub add freezed_annotation
dart pub add json_serializable --dev
Your issue will be solved.
Upvotes: 0
Reputation: 616
Had the same problem. Fixed it following these steps:
$ flutter pub get
$ flutter pub upgrade
$ flutter pub run build_runner build --delete-conflicting-outputs
Upvotes: 5
Reputation: 115
first check this article : https://flutter.dev/docs/development/data-and-backend/json and make sure of all steps : 1- add dependencies in pubspec.yaml 2- flutter pub get 3- flutter pub upgrade 4- flutter pub run build_runner build
after all, consider that:
part 'timeline.g.dart';
most be your file name which classes are in!
if your file name is difference with your class name, you should use your file name.
Upvotes: 5
Reputation: 159
flutter pub run build_runner build
Just run the above command in the console. Everything will be fine
Upvotes: -1
Reputation: 486
It may help to run "Synchronize" -- bound by default to Ctrl-Q.
You can restart the analyzer on the dart analysis tab, in the top left is a button with arrows running in a circle, if you hover over it it says 'Restart Dart Analysis Server'.
Upvotes: 7
Reputation: 1
Check have you created a constructor for class with no default parameters. Basically automated file is generated but error happens because it can not find a contractor for model
Upvotes: -1