I have the following file structure in my flutter project

```
lib
- router
-- router.gr
plugins
- myplugin //is a dart package
-- input_folder
--- swagger.json
-- lib
--- swagger_generated_code
--- myplugin.dart
-- build.yml

```

and I use the following packages

<https://pub.dev/packages/auto_route>

the router.gr is related to the auto\_route package

<https://pub.dev/packages/swagger_dart_code_generator>

and the plugin is related to the swagger\_dart\_code\_generator packge

The plugin has this build.yml from plugins/myplugin/build.yml

```
targets:
  $default:
    sources:
      - lib/**
      - input_folder/**
    builders:
      chopper_generator:
        options:
          header: "//Generated code"
      swagger_dart_code_generator:
        options:
          input_folder: "input_folder/"
          output_folder: "lib/swagger_generated_code/"

```

But what ends up happening is that I run

```
flutter packages pub run build_runner build  

```

in my project root to rebuild the router as specified by the auto\_route package. Which then gives the following error

```
FileSystemException: Cannot create file, path = './.dart_tool' (OS Error: Access is denied.
, errno = 5)
dart:io                                                                     _File.createSync
package:swagger_dart_code_generator/swagger_dart_code_generator.dart 61:30  _generateExtensions
package:swagger_dart_code_generator/swagger_dart_code_generator.dart 99:32  SwaggerDartCodeGenerator.buildExtensions
package:build_runner_core/src/package_graph/apply_builders.dart 403:33      _validateBuilder
package:build_runner_core/src/package_graph/apply_builders.dart 183:9       new BuilderApplication.forBuilder.<fn>.<fn>
package:build_runner_core/src/package_graph/apply_builders.dart 346:27      _createBuildPhasesForBuilderInCycle.<fn>.<fn>
dart:core                                                                   Iterable.toList
package:build_runner_core/src/package_graph/apply_builders.dart 293:8       createBuildPhases
package:build_runner_core/src/generate/build_impl.dart 109:29               BuildImpl.create
package:build_runner_core/src/generate/build_runner.dart 34:42              BuildRunner.create
package:build_runner/src/generate/build.dart 109:35                         build
package:build_runner/src/entrypoint/build.dart 35:18                        BuildCommand._run
package:args/command_runner.dart 209:13                                     CommandRunner.runCommand
package:build_runner/src/entrypoint/run.dart 26:18                          run
.dart_tool\build\entrypoint\build.dart 35:16                                main

```

If I open the plugin folder in a separate window and run the build command in there it works just fine for the plugin.

Is there a way to ignore the plugin folder when rebuilding the router perhaps?

But mainly my question is how can I rebuild my `router.gr` with my current structure? I can't remove the plugins folder, it needs to stay there as it is.

These are the versions I use

```
  build_runner: ^2.1.8
  auto_route_generator: ^3.2.3
  chopper_generator: ^4.0.5
  json_serializable: ^6.1.4
  swagger_dart_code_generator: ^2.4.6

```

And I am on flutter version 2.10.3