boringdeveloper / FlutterSwitch

A Custom Switch package created for Flutter.
https://pub.dev/packages/flutter_switch
BSD 3-Clause "New" or "Revised" License
78 stars 66 forks source link

while testing on iOS, in my crashlytics this message is shown every time I use the switch #14

Closed MohitSG96 closed 4 years ago

MohitSG96 commented 4 years ago

` _FlutterSwitchState#3fb33(ticker active) was disposed with an active Ticker. _FlutterSwitchState created a Ticker via its SingleTickerProviderStateMixin, but at the time dispose() was called on the mixin, that Ticker was still active. The Ticker must be disposed before calling super.dispose(). Tickers used by AnimationControllers should be disposed by calling dispose() on the AnimationController itself. Otherwise, the ticker will leak. The offending ticker was: Ticker(created by _FlutterSwitchState#3fb33(lifecycle state: created)) The stack trace when the Ticker was actually created was: #0 new Ticker. (package:flutter/src/scheduler/ticker.dart:67:40) #1 new Ticker (package:flutter/src/scheduler/ticker.dart:69:6) #2 SingleTickerProviderStateMixin.createTicker (package:flutter/src/widgets/ticker_provider.dart:131:15) #3 new AnimationController (package:flutter/src/animation/animation_controller.dart:248:21) #4 _FlutterSwitchState.initState (package:flutter_switch/flutter_switch.dart:44:28) #5 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4765:58) #6 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5) #7 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) #8 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6236:32) ... Normal element mounting (4 frames) #12 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) #13 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6236:32) ... Normal element mounting (16 frames) #29 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) #30 Element.updateChild (package:flutter/src/widgets/framework.dart:3324:20) #31 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16) #32 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:48

`
MohitSG96 commented 4 years ago

_FlutterSwitchState#3fb33(ticker active) was disposed with an active Ticker. _FlutterSwitchState created a Ticker via its SingleTickerProviderStateMixin, but at the time dispose() was called on the mixin, that Ticker was still active. The Ticker must be disposed before calling super.dispose(). Tickers used by AnimationControllers should be disposed by calling dispose() on the AnimationController itself. Otherwise, the ticker will leak. The offending ticker was: Ticker(created by _FlutterSwitchState#3fb33(lifecycle state: created)) The stack trace when the Ticker was actually created was: #0 new Ticker.<anonymous closure> (package:flutter/src/scheduler/ticker.dart:67:40) #1 new Ticker (package:flutter/src/scheduler/ticker.dart:69:6) #2 SingleTickerProviderStateMixin.createTicker (package:flutter/src/widgets/ticker_provider.dart:131:15) #3 new AnimationController (package:flutter/src/animation/animation_controller.dart:248:21) #4 _FlutterSwitchState.initState (package:flut

boringdeveloper commented 4 years ago

Hi @MohitSG96 , what version of the package are you using? This issue is similar with issue #5 and pull request #6 addressed it.