igaurab/user_location_plugin

AnimationControllers dispose exception

Opened this issue · 1 comments

Describe the bug

I'm very new in Dart and Flutter so I hope what I will describe will be helpful.
First, here is the trace:

Exception has occurred.
FlutterError (_MapsPluginLayerState#ace76(tickers: tracking 3 tickers) was disposed with an active Ticker.
_MapsPluginLayerState created a Ticker via its TickerProviderStateMixin, but at the time dispose() was called on the mixin, that Ticker was still active. All Tickers 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:
  _WidgetTicker(created by _MapsPluginLayerState#ace76(tickers: tracking 0 tickers))
  The stack trace when the _WidgetTicker was actually created was:
  #0      new Ticker.<anonymous closure> (package:flutter/src/scheduler/ticker.dart:69:40)
  #1      new Ticker (package:flutter/src/scheduler/ticker.dart:71:6)
  #2      new _WidgetTicker (package:flutter/src/widgets/ticker_provider.dart:273:80)
  #3      TickerProviderStateMixin.createTicker (package:flutter/src/widgets/ticker_provider.dart:204:34)
  #4      new AnimationController (package:flutter/src/animation/animation_controller.dart:249:21)
  #5      _MapsPluginLayerState.animatedMapMove (package:user_location/src/user_location_layer.dart:328:22)
  #6      _MapsPluginLayerState._moveMapToCurrentLocation (package:user_location/src/user_location_layer.dart:219:7)
  #7      _MapsPluginLayerState._subscribeToLocationChanges.<anonymous closure>.<anonymous closure> (package:user_location/src/user_location_layer.dart:194:13)
  #8      State.setState (package:flutter/src/widgets/framework.dart:1240:30)
  #9      _MapsPluginLayerState.setState (package:user_location/src/user_location_layer.dart:67:13)
  #10     _MapsPluginLayerState._subscribeToLocationChanges.<anonymous closure> (package:user_location/src/user_location_layer.dart:129:9)
  (elided 25 frames from dart:async))

To Reproduce
Steps to reproduce the behavior:
Switching back and forth on different views before the map animation finishes cause the crash.

Desktop (please complete the following information):

  • Occurred on: Emulator iPhone SE 2nd generation
  • OS: Catalina
  • Version 10.15.4

thanks for submitting the issue.

I am quite busy these days, will look into it soon.