of static method

GoRouter of(
  1. BuildContext context
)

Find the current GoRouter in the widget tree.

This method throws when it is called during redirects.

Implementation

static GoRouter of(BuildContext context) {
  final GoRouter? inherited = maybeOf(context);
  assert(inherited != null, 'No GoRouter found in context');
  return inherited!;
}