StateGenerator class
Generates dual-layer state files:
{Name}DomainState— regenerated every build (read-only, signal slices){Name}ViewState— scaffolded once, preserved across builds
Preservation Logic
If {Name}ViewState already exists at the output path, it is never
overwritten. The generator skips it and logs a message.
final gen = StateGenerator(outputDir: 'lib/presentation');
gen.generateDomainState('ProductDetail', useCases: [...]);
gen.generateViewState('ProductDetail', fields: [...]); // only if missing
Constructors
- StateGenerator({required String outputDir})
Properties
-
generatedFiles
→ List<
String> -
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- outputDir → String
-
final
-
preservedFiles
→ List<
String> -
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
generateDomainState(
String name, {required List< UseCaseBinding> useCases, String? presenterImport, Set<String> ? cacheableSliceKeys}) → String -
Generate
{name}DomainState— a sealed read-only container of slices. -
generateViewState(
String name, {List< ViewStateField> fields = const []}) → String -
Scaffold
{name}ViewStatewith default transient UI fields. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited