ThrottledTrigger class
Wrapper trigger that limits execution frequency to prevent CPU overload.
Throttles a base trigger to ensure it doesn't execute more than once per specified duration (in seconds). Useful for preventing tight loops when using EveryFrame or frequently-triggering ConditionTrigger.
Example:
ThrottledTrigger(
EveryFrame(),
minIntervalSeconds: 0.016, // Max 60 FPS
)
- Inheritance
-
- Object
- ScheduleTrigger
- ThrottledTrigger
Constructors
- ThrottledTrigger(ScheduleTrigger baseTrigger, {required double minIntervalSeconds})
- Wrapper trigger that limits execution frequency to prevent CPU overload.
Properties
- baseTrigger → ScheduleTrigger
-
The base trigger to throttle
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- minIntervalSeconds → double
-
Minimum time (in seconds) between executions
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
shouldRun(
World world) → bool -
Check if the schedule should run
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited