Search code examples
flutterdartdependency-injection

injectable_generator:injectable_builder on lib/src/core/di/register_modules.dart (cached):


injectable_generator:injectable_builder on lib/src/core/di/register_modules.dart (cached):

This is the error I have been getting whenever I try to flutter pub run build_runner build on my senior's code and I cannot find any solution to it. I just upgraded all the packages and fixed some minor UI changes and a data model which wasn't working due to change in response from server.

I couldn't find much on what is causing this error.

From what I know, it seems like the problem with dependency injection on regestry_module but cannot figure out what.

I tried clean and rebuild, pub upgrades and all still getting this error.


Solution

  • UPDATE

    create a new file in root directory and name it build.ymal

    global_options:
      auto_route_generator:autoRouteGenerator:
        runs_before:
          - injectable_generator:injectable_builder
    

    add these lines there and it will work