RunOnce class

RunOnce uses StackTrace.current and carefully use this to keep record on when a function has been called. It means that the call stack is basically used as a unique identifier for when and where a function has been called. See the _StackTracer for the actual usage of StackTrace.current.

RunOnce.runOnce is "scoped" in the sense it knows what file, class, method and line number in that file, that it was called from, to make sure RunOnce.runOnce only runs once in that lexical scope.

The same methodology applies to RunOnce.runOnceDestroy but only the outer lexical scope is part of its "scope"; meaning that RunOnce.runOnceDestroy "destroys" i.e. makes RunOnce.runOnce able to run once again in whatever lexical scope RunOnce.runOnceDestroy was called.

Constructors

RunOnce()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

destroy() → dynamic
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
runOnce(Function function, {Duration? forDuration}) → dynamic
toString() String
A string representation of this object.
inherited

Operators

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