of static method
Returns the next GgRouterState instance in the widget tree.
Implementation
static GgRouterCore of(
BuildContext context, {
bool rootRouter = false,
}) {
GgRouterCore? core = context.findAncestorWidgetOfExactType<GgRouterCore>();
if (rootRouter) {
final rootRouterState =
context.findRootAncestorStateOfType<GgRouterState>()!;
core = rootRouterState.rootRouterCore;
}
assert(() {
if (core == null) {
throw FlutterError(noGgRouterDelegateFoundError);
}
return true;
}());
return core!;
}