Questions tagged [build-runner]

96 questions
2
votes
1 answer

Is there a build_extensions rule in build.yaml to output all generated Flutter models in a common directory?

I am trying to create a build_extensions rule in build.yaml for builders freezed and json_serializable to output all generated models in the directory lib/generated/model, irrespective of their original location that matches lib/**/*.dart. What I…
2
votes
1 answer

Flutter Invalid argument(s): Missing Library (build_runner failure)

I'm using Flutter auto_route_generator package (which is based on built_runner) to generate auto_routes. When I run flutter packages pub run build_runner build I'm getting the above exception: [SEVERE] auto_route_generator:autoRouteGenerator…
genericUser
  • 4,417
  • 1
  • 28
  • 73
2
votes
0 answers

After "flutter packages pub run build_runner build" on m2 macbook trying to run pod install but could not success

Launching lib/main.dart on iPhone 13 Pro in debug mode... CocoaPods' output: ↳ Preparing Analyzing dependencies Inspecting targets to integrate Using ARCHS setting to build architectures of target Pods-Runner: (``) Fetching external sources ->…
algor
  • 67
  • 2
2
votes
0 answers

Rerun Task When It Fails in VSCode

I make an Android app in Flutter and I use build_runner to generate code, especially freezed codes. My tasks.json is as below: { "version": "2.0.0", "tasks": [ { "type": "flutter", "command": "flutter", …
Eray Erdin
  • 2,633
  • 1
  • 32
  • 66
2
votes
3 answers

Because testing_app requires SDK version >=2.16.1 <3.0.0, version solving failed. in flutter

I am learning more about testing and i want to use Mockito Package and Build Runner Packate then i have my class Cat inside lib/models/cat.dart then i have my lib/test/cat_test.dart file to test cat class this is my pubspec.yaml (part of it) The…
DavidIjsud
  • 51
  • 1
  • 2
  • 9
2
votes
1 answer

auto_route build_runner not building [Constructors can't have a return type]

I am implementing auto_route package inside my flutter app. I have added the code below, inside the app_router.dart file. import 'package:auto_route/annotations.dart'; import 'package:auto_route/auto_route.dart'; import…
Abhay Maurya
  • 96
  • 1
  • 7
2
votes
2 answers

Flutter: build runner throws a precompile error

I am using analyser 1.7.1. The latest build_runner build command generates the following error. flutter packages pub run build_runner build Failed to…
Rob Lyndon
  • 12,089
  • 5
  • 49
  • 74
2
votes
1 answer

Failed to precompile build_runner:build_runner:

I created a new project, added dependencies when I launch it flutter pub run build_runner build I get: /C:/Users/Michael/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:1600:40: Error:…
2
votes
0 answers

How to get function body as string using build_runner and source_gen?

My goal is to make my unit tests easy to understand. Currently, they are hard to understand because they have so many nested functions. I want to use build_runner to generate the code of the unit with all functions unwrapped. So here is an example…
TSR
  • 17,242
  • 27
  • 93
  • 197
2
votes
1 answer

How to fix Flutter build_runner error: Failed to precompile build_runner:build_runner:

I'm working on two Flutter projects, one of them has already been migrated to null safety and uses Flutter 2.0.5. The second project, the one that causes the issues, is not yet migrated to null safety and uses Flutter 1.22.6. Switching projects is…
SePröbläm
  • 5,142
  • 6
  • 31
  • 45
2
votes
2 answers

flutter build_runner: Build for specific file extensions in build.yaml

I want to speed up the build time that build_runner takes, and I also want to prevent a re-build when running build watch when I am editing files that don't have any files to generate. I know that this needs to be edited in the build.yaml file, but…
mrgnhnt96
  • 3,562
  • 1
  • 17
  • 36
2
votes
1 answer

The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again

I try to run test on codemagic with custom pre-test script. And this is my pre-test script: #!/bin/sh cd libraries cd dependencies flutter pub get cd .. cd core flutter pub get flutter pub run build_runner build --delete-conflicting-outputs cd .. cd…
R Rifa Fauzi Komara
  • 1,915
  • 6
  • 27
  • 54
2
votes
3 answers

Bad state Unexpected diagnostics on json_serializable package with flutter

I'm trying to auto generate json_serializable code for my models in flutter app. Here is an example of my model: import 'package:propro/src/models/product_model.dart'; import 'package:propro/src/models/user/address_model.dart'; import…
Tofiq Samali
  • 145
  • 1
  • 9
1
vote
1 answer

How to run json_serializable over output of another builder?

I have made a SharedPartBuilder that generates new class annotated with @JsonSerializable(). How can I configure json_serializable to run over .part file generated by my builder before all .part files are combined into one .g.dart? Inside…
zigzag
  • 579
  • 5
  • 17
1
vote
0 answers

Dart json serializable fails with custom builder and build.yaml file

I am currently developing my own code generator using the source_gen library in dart as a separate library. At first this is the build.yaml file I used for it: builders: fields_generator: import: "package:sculptor/fields_builder.dart" …
Koren Minchev
  • 81
  • 1
  • 1
  • 7