Hot reload throws error when SingleTickerProviderStateMixin is used #42054

1,513

I used TickerProviderStateMixin instead of SingleTickerProviderStateMixin.

I figured out that I used a sub widget that uses animation as well, so it counts as multiple AnimationController objects.

Share:
1,513
Ayoub Boumzebra
Author by

Ayoub Boumzebra

Flutter Developer I moved to Flutter since its inception because of its single code base approach, Reliability and smoothness which is better than any available Cross-Platform or Single Codebase language. As Flutter developer I’m experienced with: Dart lang, RxDart, working with HTTP in Flutter, Firebase Framework (Core, Auth, Database, Storage...), effectively scale UI according to different screen sizes, localization of the app, GoogleMaps and working with location, SharedPreferences, Share via other apps, and pdf viewer SKILLS & TECHNOLOGY STACK: ✅ Flutter / Dart ✅ Android native / Java ✅ IONIC 4 / Node.JS / Angular 8 ✅ FireBase ✅ Agile / Scrum / Jira / Trello I have expertise in: Flutter state management using provider, Redux, BLoC, Scoped Model. This is a pain point of flutter, and I'm a master at this point. Flutter pixel perfect and mobile responsive app development. Flutter REST API calls in UI thread, background, and foreground. POST, GET, PUT methods with and without HEADER. Flutter with Firebase services like Auth, FireStore, Real-Time Database, ML Kit, TensorFlow LIGHT(Used for the mobile apps), Storage, FCM, Events, App Invite, Short Dynamic URL, Analytics, etc. Flutter local database with SQLite. Online and Offline app. Flutter widgets and customization. Write a beautiful code using coding guidelines. Map, push, analytics, events, social media(Google, Facebook, LinkedIn, Instagram, Twitter, etc), mobile hardware, etc. Third-party lib. integration and modifications Animation Native Android and iOS app development. Which help me to create a native bridge between the flutter app. Android and iOS app publishing User, Salse, Event, analytics, tracking, etc. And much more expertise I have.

Updated on December 06, 2022

Comments

  • Ayoub Boumzebra
    Ayoub Boumzebra over 1 year

    I implemented animation in some pages, and I have used SingleTickerProviderStateMixin, when I hot reload the screen, it throws an error as follows.

    If a State is used for multiple AnimationController objects, or if it is passed to other objects and those objects might use it more than one time in total, then instead of mixing in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin.
    
    E/flutter ( 7919): [ERROR:flutter/shell/common/shell.cc(178)] Dart Error: Unhandled exception:
    E/flutter ( 7919): _SplashState is a SingleTickerProviderStateMixin but multiple tickers were created.
    E/flutter ( 7919): A SingleTickerProviderStateMixin can only be used as a TickerProvider once. If a State is used for multiple AnimationController objects, or if it is passed to other objects and those objects might use it more than one time in total, then instead of mixing in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin.