The chopper library is similar to the Retrofit library in native Android development. It utilizes the build_runner package to generate code through the flutter pub run build_runner build
command. By default, the generated files are placed in the same directory as the source files. I want to put all generated files in the lib/generated directory. While it is possible to do so for the json_serializable package, as discussed here, I have been unsuccessful trying to configure the build.yaml file for the chopper library. The following configuration has not worked:
targets:
$default:
builders:
source_gen|combining_builder:
options:
build_extensions:
'^lib/{{}}.dart': 'lib/generated/{{}}.g.dart'
chopper_generator:
options:
build_extensions:
'^lib/{{}}.dart': 'lib/generated/{{}}.chopper.dart'
How can I properly configure the build.yaml file for the chopper library?
This possibility has been just implemented with the latest version of the chopper_generator: https://github.com/lejard-h/chopper/issues/443