useLocation function

HistoryLocation useLocation(
  1. BuildContext context
)

Returns the current location (URI + state) from the nearest route scope.

Throws a FlutterError when no RouteScopeProvider is found above the current BuildContext.

Implementation

HistoryLocation useLocation(BuildContext context) {
  return RouteScopeProvider.of(context, RouteScope.location).location;
}