ViewModelBuilder<T extends ChangeNotifier> class

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 viewModel, Widget? child), @Deprecated('Prefer to use onViewModelReady instead') dynamic onModelReady(T viewModel)?, dynamic onViewModelReady(T viewModel)?, dynamic onDispose(T viewModel)?, bool disposeViewModel = true, bool createNewViewModelOnInsert = false, bool fireOnViewModelReadyOnce = false, @Deprecated('Prefer to use fireOnViewModelReadyOnce') 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 viewModel, Widget? child), @Deprecated('Prefer to use onViewModelReady instead') dynamic onModelReady(T viewModel)?, Widget? staticChild, dynamic onViewModelReady(T viewModel)?, dynamic onDispose(T viewModel)?, bool disposeViewModel = true, bool createNewViewModelOnInsert = false, bool fireOnViewModelReadyOnce = false, @Deprecated('Prefer to use fireOnViewModelReadyOnce') 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 viewModel, Widget? child)
Builder function with access to the ViewModel to build UI form
final
createNewViewModelOnInsert 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
final
fireOnViewModelReadyOnce bool
Indicates if the onViewModelReady 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.
no setterinherited
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.
finalinherited
onDispose → (dynamic Function(T viewModel)?)
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 viewModel)?)
final
onViewModelReady → (dynamic Function(T viewModel)?)
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.
no setterinherited
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.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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.
inherited