kevin-zhan/DailyZhihu

no model.g.dart file

Closed this issue · 3 comments

flutter run error:
Your application could not be compiled, because its dependencies could not be established.
The following Dart file:
/Volumes/CODE/github/flutter_DailyZhihu/lib/model.dart
...refers, in an import, to the following library:
/Volumes/CODE/github/flutter_DailyZhihu/lib/model.g.dart
Unfortunately, that library does not appear to exist on your file system.

Well, I use the lib json_serializable to do the JSON Object serialization. It's a nice tool, and do recommend you to use it.
To solve your problem, you can simply run the command flutter packages pub run build_runner watch under the root dir of the project. And it will generate the file model.g.dart automated.
Enjoy your learning.😄

I‘ll update the Tip to readme.

It is OK.
Thanks!