didChangeDependencies method

  1. @override
void didChangeDependencies()
override

Called when a dependency of this State object changes.

For example, if the previous call to build referenced an InheritedWidget that later changed, the framework would call this method to notify this object about the change.

This method is also called immediately after initState. It is safe to call BuildContext.dependOnInheritedWidgetOfExactType from this method.

Here it called for initializing the chart theme of SfCartesianChart.

Implementation

@override
void didChangeDependencies() {
  _stateProperties.renderingDetails.chartTheme = SfChartTheme.of(context);
  _stateProperties.renderingDetails.isRtl =
      Directionality.of(context) == TextDirection.rtl;
  super.didChangeDependencies();
}