Questions tagged [build-runner]

96 questions
4
votes
0 answers

Flutter build runner - Enable / disabled builders through command line

I'm on a Flutter project and we are using build_runner. We are using several builders and runnning all of them takes a long time. Our file looks like this: targets: $default: builders: package1|builder1: # ... options package1 …
Valentin Vignal
  • 6,151
  • 2
  • 33
  • 73
4
votes
1 answer

type 'ExpandIterable' is not a subtype of type 'Iterable' of 'iterable'

I want to create a api services using dio and build_runner. But when I run flutter pub run build_runner this command on terminal I got this error [SEVERE] retrofit_generator:retrofit on lib/web_services/api_services.dart: type…
Player 2nd
  • 211
  • 3
  • 7
4
votes
1 answer

Not able to generate the mobx using build runner in flutter

I am using mobx flutter for state management. but after adding the mobx in the project I am unable to build the generated file. and getting the error Bad state: Unexpected diagnostics: C:\flutter\bin\cache\dart-sdk\lib\core\uri.dart:3259:39 -…
rahul Kushwaha
  • 2,395
  • 7
  • 32
  • 64
4
votes
2 answers

inject-dart Failed to snapshot build script .dart_tool/build/entrypoint/build.dart. This is likely caused by a misconfigured builder definition

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…
erluxman
  • 18,155
  • 20
  • 92
  • 126
3
votes
0 answers

Is there a way to run build_runner only for a specific target?

My build.yaml looks like this: targets: $default: # ... drift: # ... go_router: # ... ferry: # ... If I only make a change that will impact drift for example, I'd like to only build for this target but I couldn't find any…
Gpack
  • 1,878
  • 3
  • 18
  • 45
3
votes
2 answers

How to reduce Flutter's build_runner build time

My project is getting really big and every time I run build_runner it takes too much time to build. My idea to reduce the build time is to build only files that actually need building and those are files of my current feature directory. Is there a…
Fran
  • 59
  • 1
  • 7
3
votes
0 answers

Failed to build build_runner:build_runner:

I'm trying to run flutter packages pub run build_runner build --delete-conflicting-outputs to generate freezed files but I'm getting this error. Failed to build…
Bhawna Saroha
  • 603
  • 1
  • 11
  • 28
3
votes
2 answers

SEVERE injectable_generator:injectable_builder ... type 'UnspecifiedInvalidResult' is not a subtype of type 'LibraryElementResult' in type cast

When refactoring my code and when executing build_runner, I received out of a sudden loads of errors alike [SEVERE] injectable_generator:injectable_builder on lib/application/authorization/xxx data_sync/sync_data.dart (cached): type…
w461
  • 2,168
  • 4
  • 14
  • 40
3
votes
1 answer

analyzer require 'non-nullable' language feature to be enabled

I did a mistake by migrating to null-safety then every thing become error, after fixing a lot of errors, I still get an error and the error is : [INFO] Generating build script... [INFO] Generating build script completed, took 452ms [INFO]…
ahmed
  • 444
  • 2
  • 9
3
votes
1 answer

Flutter: Read variables passed to build_runner in the build.yaml file

Is there a way to pass a variable (like a path to the build.yaml file to then have a builder run only on a single file/directory? targets: $default: builders: freezed: enabled: true generate_for: include: …
3
votes
2 answers

flutter build runner not working - The getter 'uri' was called on null

I was using flutter with build runner perfectly , but today it just getting this null error . Even thought I reverted my code changes but still the same error . the error : >[SEVERE] json_serializable:json_serializable on…
Killua San
  • 194
  • 1
  • 4
  • 12
3
votes
4 answers

How to clean the project from generated files using build_runner

I'm using MobX for my flutter project and it needs build_runner to generate related files, now I have hundred auto-generated files, now I want to remove them all, What command can lean my project from these files? I'm using following command to…
Alireza Akbari
  • 2,153
  • 2
  • 28
  • 53
2
votes
1 answer

Error generating dart client-side code from OpenAPI JSON

I am trying to generate the client-side code of an OpenAPI API using the openapi-generator-cli with the Dart-Dio generator. However, I am encountering errors during the generation process. The API JSON provided is just a small part of the whole API,…
medim
  • 48
  • 5
2
votes
3 answers

Error: Method not found: 'NullThrownError' in flutter

I was getting the below error while running the flutter application post flutter upgrade to 3.10.6 Failed to build…
Sanakhatun Shaikh
  • 2,089
  • 3
  • 11
  • 18
2
votes
4 answers

Flutter build_runner error after upgrading to flutter 3.7.0

We are executing "flutter packages pub run build_runner watch --delete-conflicting-outputs" but it throws a "Invalid argument(s): name shouldn't end with a '.'" error. It was working fine until we upgrade flutter version from 3.3.10 to 3.7.0. The…