StoreConnector<S, ViewModel> class

Build a widget based on the state of the Store.

Before the builder is run, the converter will convert the store into a more specific ViewModel tailored to the Widget being built.

Every time the store changes, the Widget will be rebuilt. As a performance optimization, the Widget can be rebuilt only when the ViewModel changes. In order for this to work correctly, you must implement == and hashCode for the ViewModel, and set the distinct option to true when creating your StoreConnector.

Inheritance

Constructors

StoreConnector({Key key, @required ViewModelBuilder<ViewModel> builder, @required StoreConverter<S, ViewModel> converter, bool distinct: false, OnInitCallback<S> onInit, OnDisposeCallback<S> onDispose, bool rebuildOnChange: true, IgnoreChangeTest<S> ignoreChange, OnWillChangeCallback<ViewModel> onWillChange, OnDidChangeCallback<ViewModel> onDidChange, OnInitialBuildCallback<ViewModel> onInitialBuild})
Create a StoreConnector by passing in the required converter and builder functions. [...]
const

Properties

builder ViewModelBuilder<ViewModel>
Build a Widget using the BuildContext and ViewModel. The ViewModel is created by the converter function.
final
converter StoreConverter<S, ViewModel>
Convert the Store into a ViewModel. The resulting ViewModel will be passed to the builder function.
final
distinct → bool
As a performance optimization, the Widget can be rebuilt only when the ViewModel changes. In order for this to work correctly, you must implement == and hashCode for the ViewModel, and set the distinct option to true when creating your StoreConnector.
final
ignoreChange IgnoreChangeTest<S>
A test of whether or not your converter function should run in response to a State change. For advanced use only. [...]
final
onDidChange OnDidChangeCallback<ViewModel>
A function that will be run on State change, after the Widget is built. [...]
final
onDispose OnDisposeCallback<S>
A function that will be run when the StoreConnector is removed from the Widget Tree. [...]
final
onInit OnInitCallback<S>
A function that will be run when the StoreConnector is initially created. It is run in the State.initState method. [...]
final
onInitialBuild OnInitialBuildCallback<ViewModel>
A function that will be run after the Widget is built the first time. [...]
final
onWillChange OnWillChangeCallback<ViewModel>
A function that will be run on State change, before the Widget is built. [...]
final
rebuildOnChange → bool
Determines whether the Widget should be rebuilt when the Store emits an onChange event.
final
hashCode → int
The hash code for this object.
read-only, inherited
key Key
Controls how one widget replaces another widget in the tree.
final, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget. [...]
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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.debug}) → String
Returns 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 ==(dynamic other) → bool
The equality operator.
inherited