Milad-Akarie / auto_route_library

Flutter route generator
MIT License
1.59k stars 403 forks source link

build_runner - Missing library material #1859

Open FufferKS opened 8 months ago

FufferKS commented 8 months ago

Hi, I recently started trying to optimise my build_runner. Something tipped of intermittent failures. On CI, from clean state, most succeed, but some report this error:

[SEVERE] auto_route_generator on lib/features/subscriptions/presentation/subscriptions_page.dart:

Invalid argument(s): Missing library: package:flutter/material.dart

It might be due to a rule I've added to build.yaml:

      auto_route_generator:
        generate_for:
          include:
            - lib/**routing**.dart
            - lib/**page**.dart

But I am not 100% sure since the problem is non deterministic.

I'm running on:

  injectable: 2.3.2
  injectable_generator: 2.4.1
  analyzer: 5.13.0
  flutter: 3.13.9
FufferKS commented 8 months ago

update - still happens when I got rid of the build.yaml custom rules, so it's not that :/

matt-hall-zory commented 6 months ago

I'm also seeing intermittent build_runner issues with "Missing Library" I logged the issue with dart-lang, but I'm in way over my head :) https://github.com/dart-lang/build/issues/3657 Rolling back flutter a few versions seems to fix the issue.

matt-hall-zory commented 6 months ago

I did manage to find a workaround. Each time I hit a file that's "missing library", I modify it with a comment, then run build runner again. Eventually I iron out the order kinks then I go back and delete the temporary comments I used to touch those files.