onDispose method Null safety
Implementation
void onDispose() {
// cancel all timers
for (var i = 0; i < timers.length; i++) {
timers[i].cancel();
}
if (globals.elementInstances.containsKey(this.widget.hashCode)) {
globals.elementInstances.remove(this.widget.hashCode);
}
}