lundi 6 avril 2020

How to fix Flutter Web Timer Tick Twice in duration given

I ran code Like this in Flutter Web

void _startTimer() {
    const oneSec = const Duration(seconds: 1);
    timer = Timer.periodic(oneSec, (time) {
          print("something");
          timer.cancel();
    });
}

and I got console like this

something
something

I ran in Master Channel

[√] Flutter (Channel master, v1.18.1-pre.15, on Microsoft Windows [Version 10.0.18362.720], locale th-TH)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Chrome - develop for the web
[!] Android Studio (version 3.5)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.43.2)
[√] Connected device (2 available)



Aucun commentaire:

Enregistrer un commentaire