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?

2

There are 2 answers

0
Mary On

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

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

0
Taofeek On

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);