dispose method

  1. @override
void dispose ()
override

Release the resources used by this object. The object is no longer usable after this method is called.

The most recently returned TickerFuture, if any, is marked as having been canceled, meaning the future never completes and its TickerFuture.orCancel derivative future completes with a TickerCanceled error.

Implementation

@override
void dispose() {
  assert(() {
    if (_ticker == null) {
      throw FlutterError(
        'AnimationController.dispose() called more than once.\n'
        'A given $runtimeType cannot be disposed more than once.\n'
        'The following $runtimeType object was disposed multiple times:\n'
        '  $this'
      );
    }
    return true;
  }());
  _ticker.dispose();
  _ticker = null;
  super.dispose();
}