zorphy 3.0.0
zorphy: ^3.0.0 copied to clipboard
A powerful code generation package for Dart/Flutter that provides clean class definitions with copyWith, JSON serialization, toString, equality, and inheritance support
/// Minimal pub.dev-discoverable example for the `zorphy` package.
///
/// Run with `dart run example/lib/main.dart` from the `zorphy` package root
/// (after `dart run build_runner build` if the generated part is not present).
library;
import 'package:zorphy_annotation/zorphy_annotation.dart';
part 'main.zorphy.dart';
/// A single v3 `@ZorphyEntity` aggregate root.
@ZorphyEntity(principalKey: #id)
abstract class $Task {
String get id;
String get title;
bool get done;
}
void main() {
final task = Task.fromTrusted(
id: '1',
title: 'Ship zorphy 3.0.0',
done: false,
);
final wire = task.toWire();
final restored = Task.fromWire(wire).getOrThrow();
print('task: ${restored.title} (done=${restored.done})');
}