Questions tagged [build-runner]
96 questions
40
votes
19 answers
Why doesn't build_runner generate files when serializing JSON in dart/flutter
I'm just trying to generate my files with the same command i stored like 3 months ago (i'm not very good with backend and devops) and now it doesn't generate the files anymore.
It tells me to use the delete command which i don't remember but even…

morgred
- 969
- 5
- 15
- 26
19
votes
2 answers
Is there a way to put the generated files in a separate folder in flutter?
In my app, I use freezed with json_serializable. In the folder, where I put all my data models a lot of generated files, like model.g.dart, model.freeezed.dart. Is there any possibility to move all generated files like that to a separate folder in…

Денис Тараненко
- 341
- 2
- 10
12
votes
3 answers
I migrated to null safety and i cant run "flutter pub run build_runner build" without an error being thrown
I have added // @dart=2.9 to all my files but the build_runner won't do its thing without throwing this error:
Warning: Operand of null-aware operation '?.' has type 'SendPort' which excludes null. - 'SendPort' is from 'dart:isolate'. …

nnamdi
- 131
- 1
- 6
9
votes
2 answers
Flutter Build_Runner Build Failing While Generating Mocks
Running build_runner to generate mocks using the Mockito package fails.
Terminal output:
[INFO] Generating build script... [INFO] Generating build script
completed, took 2.2s
[INFO] Precompiling build script......…

Dfx11
- 103
- 6
9
votes
5 answers
Error: "type 'UnspecifiedInvalidResult' is not a subtype of type 'LibraryElementResult' in type cast" in Flutter Hive
I run flutter packages pug run build_runner build, the normal command with which you would create a TypeAdapter in Flutter, I get the following error:
type 'UnspecifiedInvalidResult' is not a subtype of type 'LibraryElementResult' in type cast
It…

Boothosh81
- 387
- 1
- 5
- 24
8
votes
2 answers
How run flutter 'packages pub run build_runner build' with debug mode in intellij idea?
I want to put break point on my generator code, but I don't know how to run the command on the debug mode.
I wrote generator using source_gen and build_runner
class MyGenerator extends GeneratorForAnnotation {
@override
FutureOr…

Ivan
- 256
- 3
- 13
7
votes
1 answer
How to debug flutter build_runner build in VS Code?
Problem statement:
I am building a code generator with the build_runner package.
I run flutter pub run build_runner build to execute my code generators.
Question:
How can I debug flutter pub run build_runner build with breakpoints?
Similar…

Jens
- 2,592
- 2
- 21
- 41
7
votes
5 answers
Flutter build_runner watch Not Working | The getter 'definingUnit' was called on null
After running flutter pub run build_runner watch --delete-conflicting-outputs
Build Runner Output
$ flutter pub run build_runner watch --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took…

Alex Bryson
- 75
- 1
- 4
7
votes
3 answers
How to generate Dart code for annotations at fields?
I'm writing a code generator for Dart using the build_runner, but my builder is not being called for annotations at fields, although it does work for annotations at classes.
Is it possible to also call the generator for annotations at fields (or at…

Marcel
- 8,831
- 4
- 39
- 50
6
votes
3 answers
Flutter build runner - pub finished with exit code 65
EDIT 3 This must be a font_awesome_flutter issue. When I leave dependency_overrides in pubspec.yaml but remove the font_awesome_flutter argument, so just do this:
dependency_overrides:
It works.
I upgraded to flutter 2.0 and now I get this error…

BeniaminoBaggins
- 11,202
- 41
- 152
- 287
6
votes
1 answer
dart modularization with build_runner
I have a project which consists of one runable project and multiple local packages. These packages are modules and a core framework. I am using json serialization and other packages which depend on build_runner. The problem I am facing is that if I…

DirtyNative
- 2,553
- 2
- 33
- 58
5
votes
1 answer
How to work with classes extended from EnumClass and generated by build_runner in Dart/Flutter?
For converting my GraphQL schema into Dart classes, I'm using the Ferry package, and I run this using build_runner.
In my database, I've defined the following enum type:
CREATE TYPE my_schm.currency AS ENUM ('CNY','EUR','PEN','USD');
Here is a…

Ουιλιαμ Αρκευα
- 5,561
- 7
- 35
- 61
4
votes
1 answer
flutter pub run build_runner build is Deprecated
When I run flutter pub run build_runner build --delete-conflicting-outputs, I get this error:
Deprecated. Use `dart run` instead.
[INFO] Generating build script completed, took 169ms
[WARNING]…

Mahdi Dahouei
- 1,588
- 2
- 12
- 32
4
votes
0 answers
Nothing can be built, yet a build was requested
I'm trying to store a list of objects with Hive in flutter.
The ChatModel (chat_model.dart) class looks like this:
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
part…

Ballazx
- 431
- 4
- 12
4
votes
5 answers
flutter build_runner giving 0 output after being executed
Im having issues to get the desired output for my json file with the build_runner it runs successfully but isn't giving any outputs
my first.dart file
```
import 'package:json_annotation/json_annotation.dart';
part…

Karan Raghwani
- 41
- 3