of static method

Returns the nearest GlassAdaptiveScopeData from the widget tree.

Throws a FlutterError if no GlassAdaptiveScope ancestor is found. Use maybeOf in contexts where the scope may not be present.

Implementation

static GlassAdaptiveScopeData of(BuildContext context) {
  final data = maybeOf(context);
  assert(
    data != null,
    'GlassAdaptiveScopeData.of() was called on a context that does not have '
    'a GlassAdaptiveScope ancestor. Make sure GlassAdaptiveScope is placed '
    'above this widget in the tree.',
  );
  return data!;
}