TickingStateMixin<T extends StatefulWidget> mixin
A mixin class that provides the ticking functionality to the widget. This mixin class can be used with the State class to provide the ticking functionality to the widget.
This will automatically start the ticker when the widget is initialized based on the autoStart property.
This will automatically rebuild the widget at the given interval based on the mode property.
To use this mixin, the State class must also use the TickerProvider mixin via the SingleTickerProviderStateMixin or TickerProviderStateMixin.
Note that SingleTickingStateMixin
must be defined after TickerProvider
in the mixin list, otherwise, it will throw a compile-time error.
- Superclass Constraints
- Implemented types
Properties
- autoStart ↔ bool
-
If true, the ticker will start automatically when the widget is initialized.
If this is set to false, the ticker will not start automatically when the
widget is initialized. To start the ticker, use the startTicker method.
getter/setter pair
- context → BuildContext
-
The location in the tree where this widget builds.
no setterinherited
- currentTime ↔ DateTime
-
The current time when the widget is being rebuilt.
getter/setter pairoverride
- elapsed ↔ Duration
-
Duration elapsed since the ticker started.
Resets to zero when ticker is started.
getter/setter pairoverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- mode ↔ TickingMode
-
The mode of ticking. It can be millisecond, second, minute, or hour.
This is used to determine when to rebuild the widget.
getter/setter pairoverride
- mounted → bool
-
Whether this State object is currently in a tree.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- ticker ↔ Ticker
-
The ticker that is used to control the ticking of the widget.
getter/setter pairoverride
- widget → T
-
The current configuration.
no setterinherited
Methods
-
activate(
) → void -
Called when this object is reinserted into the tree after having been
removed via deactivate.
inherited
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
inherited
-
createTicker(
TickerCallback onTick) → Ticker -
Creates a ticker with the given callback.
inherited
-
deactivate(
) → void -
Called when this object is removed from the tree.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
didChangeDependencies(
) → void -
Called when a dependency of this State object changes.
inherited
-
didUpdateWidget(
covariant T oldWidget) → void -
Called whenever the widget configuration changes.
inherited
-
dispose(
) → void -
Called when this object is removed from the tree permanently.
override
-
initState(
) → void -
Called when this object is inserted into the tree.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onTick(
Duration elapsed) → void - Called every time the ticker ticks. Determines when to rebuild the widget.
-
reassemble(
) → void -
Called whenever the application is reassembled during debugging, for
example during hot reload.
inherited
-
setMode(
TickingMode mode) → void -
Sets the mode of the ticker to the given TickingMode.
override
-
setState(
VoidCallback fn) → void -
Notify the framework that the internal state of this object has changed.
inherited
-
startTicker(
) → void -
Starts the ticker.
override
-
stopTicker(
) → void -
Stops the ticker.
override
-
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
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited