of static method

GoRouter of(
  1. BuildContext context
)

Find the current GoRouter in the widget tree.

Implementation

static GoRouter of(BuildContext context) {
  final InheritedGoRouter? inherited =
      context.dependOnInheritedWidgetOfExactType<InheritedGoRouter>();
  assert(inherited != null, 'No GoRouter found in context');
  return inherited!.goRouter;
}