FlutterInheritedState constructor
An annotation used to define a sub-state within a model class.
It allows for the separation of complex model states and logic into multiple smaller state classes, improving code readability and maintainability.
Example:
@FlutterInheritedState()
class UserProfileState with _$UserProfileState {
UserProfileState._();
factory UserProfileState() = _$UserProfileState;
@inheritedModelState
late String name;
}
@FlutterInheritedModel()
class MyModel with _$MyModel {
final userProfile = UserProfileState();
}
Implementation
const FlutterInheritedState({this.name, this.useAsyncWorker = false});