The code_builder
package helps generate valid Dart source code programmatically, usually as part of a build process or generation step. Most of the API currently takes a little exploring to get used to, it's recommended to read the API documentation, or read the getting started guide.