ViewModelBuilder<T extends ChangeNotifier> class Null safety

A widget that provides base functionality for the Mvvm style provider architecture by FilledStacks.

Inheritance

Constructors

ViewModelBuilder.nonReactive({required T viewModelBuilder(), required Widget builder(BuildContext context, T model, Widget? child), dynamic onModelReady(T model)?, dynamic onDispose(T model)?, bool disposeViewModel = true, bool createNewModelOnInsert = false, bool fireOnModelReadyOnce = false, bool initialiseSpecialViewModelsOnce = false, Key? key})
Constructs a ViewModel provider that will not rebuild the provided widget when notifyListeners is called. [...]
const
ViewModelBuilder.reactive({required T viewModelBuilder(), required Widget builder(BuildContext context, T model, Widget? child), Widget? staticChild, dynamic onModelReady(T model)?, dynamic onDispose(T model)?, bool disposeViewModel = true, bool createNewModelOnInsert = false, bool fireOnModelReadyOnce = false, bool initialiseSpecialViewModelsOnce = false, Key? key})
Constructs a ViewModel provider that fires the builder function when notifyListeners is called in the ViewModel.
const

Properties

builder Widget Function(BuildContext context, T model, Widget? child)
Builder function with access to the ViewModel to build UI form
final
createNewModelOnInsert bool
When set to true a new ViewModel will be constructed everytime the widget is inserted. [...]
final
disposeViewModel bool
Indicates if you want Provider to dispose the ViewModel when it's removed from the widget tree. [...]
final
fireOnModelReadyOnce bool
Indicates if the onModelReady should fire every time the ViewModel is inserted into the widget tree. Or only once during the lifecycle of the ViewModel.
final
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
initialiseSpecialViewModelsOnce bool
Indicates if we should run the initialise functionality for special ViewModels only once
final
key Key?
Controls how one widget replaces another widget in the tree. [...]
final, inherited
onDispose → (dynamic Function?(T model)?)
Fires when the widget has been removed from the widget tree and allows you to dispose of any controllers or state values that need disposing
final
onModelReady → (dynamic Function?(T model)?)
Fires once when the ViewModel is created or set for the first time [...]
final
providerType → _ViewModelBuilderType
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
staticChild Widget?
final
viewModelBuilder → T Function()
A builder function that returns the ViewModel for this widget
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
inherited
createState() → _ViewModelBuilderState<T>
Creates the mutable state for this widget at a given location in the tree. [...]
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object. [...]
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
@nonVirtual, inherited