admin管理员组文章数量:1388903
I have a flutter project using retrofit that was working fine.
I decided to move my freezed models and retrofit files to a separate project in order to be reused with another project. I updated my imports
and pubspec.yaml
to properly include the new project and receive no errors in VSCODE.
When I goto to build my project, I am receiving the following on all my retorfit .g generated files:
../gtp-flutter-data/lib/data/providers/cart_api_service.g.dart:24:9:
Error: Type 'ParseErrorLogger' not found.
final ParseErrorLogger? errorLogger;
I have no errors in either the new or the main data project, but this appears when building.
Any suggestions on what is going on?
I have a flutter project using retrofit that was working fine.
I decided to move my freezed models and retrofit files to a separate project in order to be reused with another project. I updated my imports
and pubspec.yaml
to properly include the new project and receive no errors in VSCODE.
When I goto to build my project, I am receiving the following on all my retorfit .g generated files:
../gtp-flutter-data/lib/data/providers/cart_api_service.g.dart:24:9:
Error: Type 'ParseErrorLogger' not found.
final ParseErrorLogger? errorLogger;
I have no errors in either the new or the main data project, but this appears when building.
Any suggestions on what is going on?
Share Improve this question edited Mar 15 at 1:47 Hilory 2,1377 gold badges14 silver badges30 bronze badges asked Mar 15 at 1:13 user3211352user3211352 615 bronze badges3 Answers
Reset to default 3It might happen for some reason, so do try all steps:
Check and verify that
ParseErrorLogger
is correctly defined and accessible in your new shared project.Try rebuilding the generated files:
flutter pub run build_runner clean
flutter pub run build_runner build --delete-conflicting-outputs
in both the main project and the shared data project.
Ensure that the shared project includes all necessary dependencies (
retrofit
,freezed
,json_serializable
, etc.) in your pubspec.yaml file.Confirm that
ParseErrorLogger
is imported where you are using it.
I finally figured it out, albeit I’m not sure why what I did worked. I ended up solving this by temporarily commenting out retrofit in the main project pubspec.yaml and building the project.
After this build it did not matter whether retrofit was included or commented out anymore in the pubspec.yaml of the main project.
you can try
import 'package:retrofit/retrofit.dart' instead of import 'package:retrofit/http.dart';
ref: https://github/trevorwang/retrofit.dart/issues/722#issuecomment-2511423771
本文标签: dartFlutter Error Type 39ParseErrorLogger39 not foundStack Overflow
版权声明:本文标题:dart - Flutter Error: Type 'ParseErrorLogger' not found - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744626681a2616300.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论