of static method

Retrieves the ShadToasterState from the nearest ShadToaster ancestor.

Throws a FlutterError if no ShadToaster is found in the widget tree.

Implementation

static ShadToasterState of(BuildContext context) {
  final provider = maybeOf(context);
  if (provider == null) {
    throw FlutterError(
      '''Could not find ShadToaster InheritedWidget in the ancestor widget tree.''',
    );
  }
  return provider;
}