copywith

package
v1.17.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: BSD-3-Clause Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Generate(dir, skip string) ([]byte, error)

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

func Run(args []string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL