of static method

AnimatedCircularChartState? of(
  1. BuildContext context, {
  2. bool nullOk = false,
})

The state from the closest instance of this class that encloses the given context.

This method is typically used by AnimatedCircularChart item widgets that insert or remove items in response to user input.

AnimatedCircularChartState animatedCircularChart = AnimatedCircularChart.of(context);

Implementation

static AnimatedCircularChartState? of(BuildContext context,
    {bool nullOk: false}) {
  assert(context != null);
  assert(nullOk != null);

  final AnimatedCircularChartState? result = context
      .findAncestorStateOfType<AnimatedCircularChartState>();

  if (nullOk || result != null) return result;

  throw new FlutterError(
      'AnimatedCircularChart.of() called with a context that does not contain a AnimatedCircularChart.\n'
      'No AnimatedCircularChart ancestor could be found starting from the context that was passed to AnimatedCircularChart.of(). '
      'This can happen when the context provided is from the same StatefulWidget that '
      'built the AnimatedCircularChart.\n'
      'The context used was:\n'
      '  $context');
}