periodic static method
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(),
);
}