4

I was trying to use inject-dart from Google by following this article

But when I try to generate the code with build-runner but I see this error.

[SEVERE] Failed to snapshot build script .dart_tool/build/entrypoint/build.dart. This is likely caused by a misconfigured builder definition. [SEVERE] ../../../../dev/flutter/.pub-cache/git/inject.dart-4ffd3d339d8b776b2bec8d95ae6d3d168856e76c/package/inject_generator/lib/src/context.dart:106:51: Error: Method not found: 'ParsedLibraryResultImpl.tmp'. var parsedLibrary = ParsedLibraryResultImpl.tmp(element.library);
^^^

Does anyone have any idea what is causing the issue?

erluxman
  • 18,155
  • 20
  • 92
  • 126

2 Answers2

11

use element.library.session.getParsedLibraryByElement(element.library);

instead of ParsedLibraryResultImpl.tmp(element.library); in Context.dart line 106

Mary
  • 487
  • 4
  • 18
0

I had the same error lately, @Mary answer helped me.

Just change the Context.dart line that is causing the headache to:

element.library.session.getParsedLibraryByElement(element.library);
Taofeek
  • 131
  • 2
  • 5