Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Error: Type 'ParseErrorLogger' not found

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?

like image 564
user3211352 Avatar asked May 04 '26 08:05

user3211352


2 Answers

you can try

import 'package:retrofit/retrofit.dart' instead of import 'package:retrofit/http.dart';

ref: https://github.com/trevorwang/retrofit.dart/issues/722#issuecomment-2511423771

like image 136
Duc Canh Bui Avatar answered May 06 '26 01:05

Duc Canh Bui


It might happen for some reason, so do try all steps:

  1. Check and verify that ParseErrorLogger is correctly defined and accessible in your new shared project.

  2. 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.

  3. Ensure that the shared project includes all necessary dependencies (retrofit, freezed, json_serializable, etc.) in your pubspec.yaml file.

  4. Confirm that ParseErrorLogger is imported where you are using it.

like image 36
Affan Minhas Avatar answered May 06 '26 01:05

Affan Minhas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!