of static method
Returns the nearest Scene above the given context
.
Implementation
static Scene of(BuildContext context) {
final result =
context.dependOnInheritedWidgetOfExactType<_SceneMarker>()?.scene;
if (result == null) {
throw FlutterError.fromParts([
ErrorSummary('Could not find an ancestor `Scene` widget'),
ErrorHint(
'Ensure there is a `Scene` widget above every `Window` widget',
),
]);
}
return result;
}