Documentation
¶
Overview ¶
Package copywith implements the `glutter-gen copywith` subcommand, which generates the CopyWith methods of the immutable value classes (ThemeData, ColorScheme, TextTheme...), as SPEC §12.3 describes.
Flutter: no counterpart.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
Generate reads the Go package in dir and returns the source of the generated file. The file with the name skip (the output) is not read.
Flutter: no counterpart.
func Run ¶
Run executes `glutter-gen copywith [-dir dir] [-out file]` with the arguments that follow the subcommand name. It reads the Go files of the package in dir (the working directory by default), and for every struct whose doc comment holds the line `//glutter:copywith` it writes, to the output file (copywith_gen.go in dir by default), a struct XCopy whose fields are the fields of X as foundation.Opt, and a CopyWith(XCopy) method that returns a copy of X with the fields that are set replaced. A field that already is a foundation.Opt keeps its type in XCopy and is replaced when it is set. A field with the struct tag `copywith:"-"` is left out. The comment line `Flutter: <file> <Name>` of the struct's doc comment becomes the Flutter reference of the generated code, with `.copyWith` added.
Flutter: no counterpart.
Types ¶
This section is empty.