checkInterval method

bool checkInterval(
  1. String key,
  2. int intervalInMilli,
  3. double dt, {
  4. bool firstCheckIsTrue = true,
})

Returns true if for each time the defined millisecond interval passes. Like a Timer.periodic Used in flows involved in the update

Implementation

bool checkInterval(
  String key,
  int intervalInMilli,
  double dt, {
  bool firstCheckIsTrue = true,
}) {
  _timers ??= {};
  if (_timers![key]?.interval != intervalInMilli) {
    _timers![key] = IntervalTick(intervalInMilli);
    return firstCheckIsTrue;
  } else {
    return _timers![key]?.update(dt) ?? false;
  }
}