SuperWidget<T extends SuperViewModel> class
abstract
A StatelessWidget that provides the base functionality for widgets that work with a SuperViewModel.
This widget serves as a foundation for building widgets that require a view model to manage their state and lifecycle. By extending SuperWidget and providing a concrete implementation of initViewModel(), you can easily associate a view model with the widget.
Note: It is recommended to use one view model per widget to ensure proper encapsulation and separation of concerns. Each widget should have its own dedicated view model for managing its state and lifecycle. This approach promotes clean and modular code by keeping the responsibilities of each widget and its associated view model separate.
If you have a widget that doesn't require state management or interaction with a view model, it is best to use a vanilla StatelessWidget instead. Using a view model in a widget that doesn't have any state could add unnecessary complexity and overhead.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- SuperWidget
Constructors
- SuperWidget({Key? key})
-
The key for the widget.
const
Properties
- controller → T
-
Deprecated to align with Flutter's MVVM architecture,
Use ref instead.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- ref → T
-
The widget view model reference.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildContext context) → Widget - Builds the widget based on the given BuildContext.
-
createElement(
) → _SuperElement< T> -
Inflates this configuration to a concrete instance.
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
-
initViewModel(
) → T - Initializes the view model for the widget.
-
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, int wrapWidth = 65}) → 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