of static method
Implementation
static InitializedVRouterSailor of(BuildContext context) {
InitializedVRouterSailor? vRouterData;
// First try to get a local MaterialVRouterData
vRouterData =
context.dependOnInheritedWidgetOfExactType<LocalVRouterData>();
if (vRouterData != null) {
return vRouterData;
}
// Else try to get the root MaterialVRouterData
vRouterData = context.dependOnInheritedWidgetOfExactType<RootVRouterData>();
if (vRouterData != null) {
return vRouterData;
}
if (vRouterData == null) {
throw FlutterError(
'VRouter.of(context) was called with a context which does not contain a VRouter.\n'
'The context used to retrieve VRouter must be that of a widget that '
'is a descendant of a VRouter widget.');
}
return vRouterData;
}