GgOncePerCycle class

Takes a task and makes sure that trigger does execute the task only one time in a run loop cycle.

Constructors

GgOncePerCycle({required void task(), bool isTest = false, void scheduleTask(void task()) = scheduleMicrotask})
The task to be triggered only one time in a run loop cycle.

Properties

hashCode int
The hash code for this object.
no setterinherited
isTest bool
Returns true if this is run in a test environmen
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scheduleTask ↔ void Function(void task())
Use this method to schedule a task
getter/setter pair
task ↔ void Function()
The task to be triggered
getter/setter pair

Methods

dispose() → void
Call this method if triggered tasks shoult not be triggered anymore
executeNow() → void
The task will only be triggered once in a cycle. Use [isTest] = false and executeNow() to control the execution.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
trigger({void scheduleTask(void task())?}) → void
This method triggers the task, but only if it has not already been executed during this run loop cycle.

Operators

operator ==(Object other) bool
The equality operator.
inherited