← ClaudeAtlas

freezedlisted

GM Freezed patterns — model, DTO, state, event, failure, params for Flutter Clean Architecture
ghozimahdi/gm-aiagent-plugins · ★ 0 · AI & Automation · score 67
Install: claude install-skill ghozimahdi/gm-aiagent-plugins
Resolve `UFIL_ROOT` to the plugin root containing this skill. Claude Code may provide `CLAUDE_PLUGIN_ROOT`; Codex can resolve it from the installed skill path. ## Freezed Patterns (GM Standard) ### Model (Domain Layer) — `@Default`, NO nullable ```dart @freezed sealed class PropertyModel with _$PropertyModel { const factory PropertyModel({ @Default('') String id, @Default('') String name, @Default('') String address, @Default('') String type, @Default(0) int totalUnits, @Default(0) int occupiedUnits, @Default(0) double monthlyRevenue, }) = _PropertyModel; } ``` Rules: - ALL fields use `@Default()` — no nullable `?` fields - `sealed class` with `_$` mixin - No `fromJson`/`toJson` — models are pure domain objects - Private constructor `const factory` only ### Model / Params with DateTime — `required DateTime` + `.empty()` factory (MANDATORY) Any domain freezed class (`*_model.dart`, `*_params.dart`, `*_result.dart`) that has one or more `DateTime` fields MUST: 1. Mark every DateTime as `required DateTime` (never nullable, never `DateTime?`). 2. Provide a `.empty()` factory that supplies `DateTime.now()` for each DateTime field. ```dart @freezed abstract class ListingPhotoModel with _$ListingPhotoModel { const factory ListingPhotoModel({ @Default('') String id, @Default('') String listingId, @Default('') String imageUrl, @Default(0) int sortOrder, required DateTime createdAt, }) = _ListingPhotoModel; factory List