dispose method

  1. @override
void dispose()
override

Called when this object is removed from the tree permanently.

The framework calls this method when this State object will never build again. After the framework calls dispose, the State object is considered unmounted and the mounted property is false. It is an error to call setState at this point. This stage of the life cycle is terminal: there is no way to remount a State object that has been disposed.

Sub classes should override this method to release any resources retained by this object.

  • In dispose, unsubscribe from the object.

Here it end the animation controller of the series in SfCircularChart.

Implementation

@override
void dispose() {
  disposeAnimationController(
      _stateProperties.renderingDetails.animationController,
      _repaintChartElements);
  super.dispose();
}