Questions tagged [dart-build]

Questions about creating Dart code generators and configuring the build system.

are a set of packages for Dart code generation and build tools.

These build tools are used to compile Dart code to JavaScript or for generating code from other source or configuration files.

Use this tag for questions related to configuring exiting builders or build your own builders.

14 questions
16
votes
1 answer

Where is build.yaml file in Flutter project?

I am looking for a build.yaml file in the flutter project, but I can't find it. Is there any way I can edit this file?
Michael Cube
  • 195
  • 2
  • 10
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
2 answers

Error while running built value generator

I got an error while trying to use built value generator This was the error that i got. [INFO] Running build... [INFO] Generating SDK summary. [SEVERE] built value generator:built value on lib/json_parsing.dart: Bad state: Unexpected…
Mr.Despicable
  • 373
  • 1
  • 4
  • 14
2
votes
1 answer

Error using source generator from a source generator package

I am writing a dart source generator that is using json_serializable for some of it models. Initially the source generation was working fine for some time but now when I run dart run build_runner build --delete-conflicting-outputs I am getting…
Soumya Mahunt
  • 2,148
  • 12
  • 30
2
votes
1 answer

Change webdev serve directory

prentend that I have a file in .../web/main.dart and when I'm serving the app ( webdev serve web:8080) it will be located in localhost:8080/main.dart.js and the packages in localhost:8080/packages/ is there anyway to move them to…
Mattia
  • 5,909
  • 3
  • 26
  • 41
1
vote
1 answer

How to get annotation field names in when generating code with source_gen

I am trying to implement a generator based on source_gen. It will process classes annotated with ClassAnnotation and act on fields annotated with various annotations, all of which are subtypes of a 'marker' interface FieldAnnotationMarker. Here is…
wujek
  • 10,112
  • 12
  • 52
  • 88
1
vote
0 answers

How to inherit config from default build.yaml file for custom configuration

Dart build.yaml docs proposes this approach to build with custom configurations: If you need other configurations in addition to dev and release, you can define multiple build.yaml files. For instance if you have a build.debug.yaml file you can…
Soumya Mahunt
  • 2,148
  • 12
  • 30
1
vote
1 answer

Trying to create a custom builder results in a non unique output error

I'm trying to create custom builder for my Flutter project. I want to achieve something similar to built_value code generation. I've started by creating build.yaml in the root folder of my project targets: $default: builders: …
Olegas
  • 10,349
  • 8
  • 51
  • 72
1
vote
1 answer

Dart Analyzer: Find instances of a class or its descendants

I am using the build package to take a .dart file and look for definitions of a certain class or its subclasses. Can ClassElement be used for subclasses too? I am only expecting a single definition of a specific class to be within one file of the…
Jacob Phillips
  • 8,841
  • 3
  • 51
  • 66
0
votes
1 answer

Generate files with one input to multiply outputs

I'm trying to create a code generator that takes input a JSON file and generates multiple classes in multiple files. And my question is, is it possible to create multiple files for one input using build from dart lang?
Artur Sikora
  • 65
  • 1
  • 8
0
votes
0 answers

dart reflectable in library

I'm making a library for persistence implementation. For that I want to use reflection to be able to restore an object from the storage. I can't use dart:mirrors because this library will be use also in Flutter application. So I'm trying to use…
Ralfeus
  • 845
  • 9
  • 31
0
votes
1 answer

Flutter: code analysis and layout explorer in code at build time

I'm new to flutter, so I hope my question will not be too much out of scope: I would like to extract meta informations about the app at build time. The idea is to have JSON tree of the app widgets and send it to an external database via API call for…
TOPKAT
  • 6,667
  • 2
  • 44
  • 72
0
votes
2 answers

dart build: Need to inject an asset from an application into a dependency package

Background: I have a package with Angular (5.0.0, Dart 2.0.0) components (let's call it my_components) that I use in many customer projects (app_1, app_2, ...). These apps must override some CSS properties (e.g. colors) of almost every component I…
0
votes
1 answer

Dart `build_config` rename `buildStep.inputId` file

I want to rename (not just the extension) a file in my Builder. Is there any reason I shouldn't just create my own File based on buildStep.inputId and write to the file?
Jacob Phillips
  • 8,841
  • 3
  • 51
  • 66