DateTimeLoopBuilder class
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DateTimeLoopBuilder
Constructors
- DateTimeLoopBuilder({Key? key, TimeUnit? timeUnit, DateTimeLoopController? controller, DateTime getNow()?, bool triggerOnStateChange = true, required DateTimeLoopWidgetBuilder builder, Widget? child})
-
DateTimeLoopBuilder is a Widget that listens to the system's datetime and triggers
a rebuild of its child widget based on the specified time unit.
This allows you to create dynamic UI elements that update at regular intervals.
const
Properties
- builder → DateTimeLoopWidgetBuilder
-
A function to build the widget based on the current datetime (required).
final
- child → Widget?
-
An optional child widget to be passed to the builder.
final
- controller → DateTimeLoopController?
-
An optional custom controller to use for datetime updates. If provided,
timeUnit and triggerOnStateChange (for creation) are ignored, but
triggerOnStateChange still controls immediate triggers on widget state changes.
This allows users to manage the controller externally, e.g., for pause/resume functionality.
final
- getNow → DateTime Function()?
-
A function to provide the current DateTime. Defaults to DateTime.now.
This can be overridden for testing or simulation purposes to mock the system time.
If provided, it is used for the initial data and passed to the internal controller if created.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeUnit → TimeUnit?
-
The time unit for updates. Required if controller is not provided.
final
- triggerOnStateChange → bool
-
Whether to trigger an initial build immediately upon widget creation or state change,
even if the elapsed time based on timeUnit hasn't passed yet.
If set to
false, the initial build will happen at the first change in system time that aligns with the specified timeUnit. (default:true).final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< DateTimeLoopBuilder> -
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, 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