periodic static method

Timer periodic(
  1. int milliseconds,
  2. VoidCallback callback
)

Create a periodic timer that executes a callback every few milliseconds. DO THAT:

return Timer.periodic(Duration(milliseconds: milliseconds), (_) => callback());

Implementation

static Timer periodic(int milliseconds, VoidCallback callback) {
  return Timer.periodic(
    Duration(milliseconds: milliseconds),
    (_) => callback(),
  );
}