of static method

Retrieves the SurveyStateProvider from the widget tree.

The context must have a SurveyStateProvider ancestor. Throws an assertion error if no provider is found.

Implementation

static SurveyStateProvider of(BuildContext context) {
  final result =
      context.dependOnInheritedWidgetOfExactType<SurveyStateProvider>();
  assert(result != null, 'No SurveyStateProvider found in context');
  return result!;
}