of static method
Gets the nearest AdaptiveData from the widget tree.
Throws an error if AdaptiveScope is not found in the ancestor tree.
Implementation
static AdaptiveData of(BuildContext context) {
final data = context.dependOnInheritedWidgetOfExactType<AdaptiveData>();
if (data == null) {
throw FlutterError(
'AdaptiveData.of() called with a context that does not contain an AdaptiveScope.\n'
'No AdaptiveScope ancestor could be found starting from the context that was passed '
'to AdaptiveData.of().\n'
'Wrap your app with AdaptiveScope:\n'
' AdaptiveScope(\n'
' child: MaterialApp(...),\n'
' )',
);
}
return data;
}