single_file_build_runner 0.0.2%2B15

SDKdartflutter
Platformandroidioswindowslinuxmacos

A more efficient way to use the build_runner to generate code for a single file.

Single File Build Runner

Quick Guide

Prerequisites

  1. The repository must use git.
  2. The repository must have a pubspec.yaml file which has the build_runner as a dependency.
  3. All Files generated by the build_runner must either be staged or commited. This script will otherwise delete them!

Usage

Run dart run single_file_build_runner <path/from/content/root/filename.dart <generatorName> <generatorName> in the root of the repository. Generator names currently only support injectable, copy_with, freezed and json_serializable. Alternatively run dart run single_file_build_runner <path/from/content/root/filename.dart <generatorName> <generatorName>

Example

Running flutter packages pub run single_file_build_runner lib/<path>/file.dart injectable freezed in a project with around 1500 regular and 250 generated files on a Mac from 2019 took around xx seconds. Running the build_runner normally takes around 12 Minutes!