Skip to main content

Patch Updates

Patch helpers generate small, composable updates. This references basic_example.dart, nested_example.dart, and no_patch_example.dart.

Patch a single entity

final patch = UserPatch.create()
..withAge(32)
..withEmail('alice@example.com');

final patched = user.patchWithUser(patchInput: patch);

Nested patching

final personPatch = PersonPatch.create()
..withAddressPatch(AddressPatch.create()..withCity('Los Angeles'));

Turn off patch generation

(generatePatch: false, generateJson: true)
abstract class $NoPatchUser {
String get name;
int get age;
}