flutter-image-sequence-animator
flutter-image-sequence-animator copied to clipboard
onFinishPlaying is being called twice
I am having a problem on my app where the init method is being called twice, after some tests I realized that onFinishPlyaing is being called twice, could you help me with that? Thank you.
ImageSequenceAnimator(
"assets/animation",
"frame_",
0,
0,
"png",
22,
fps: 20,
onFinishPlaying: (imageSequenceAnimatorState){
print("onFinishPlaying");
splashController.init();
},
),
onFinishPlaying // it prints twice
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale en-BR) • Flutter version 2.5.3 at /Users/djalma/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18116933e7 (7 weeks ago), 2021-10-15 10:46:35 -0700 • Engine revision d3ea636dc5 • Dart version 2.14.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/djalma/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • ANDROID_HOME = /Users/djalma/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 13.1, Build version 13A1030d • CocoaPods version 1.10.2
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[✓] Connected device (3 available) • iPad Pro (9.7-inch) (mobile) • 0C8AB907-97CE-4FD7-B4EC-A38A33242FDC • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 11.6 20G165 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.55
• No issues found!
As workaround I had to create a bool variable to make sure my init method will called only once.
bool onFinishPlayingCalled = false;

Thank you for the feedback. I will take a look at this right away.