push<T extends Object?> method

Future<T?> push<T extends Object?>(
  1. String location, {
  2. Object? extra,
})

Push a URI location onto the page stack w/ optional query parameters and promise, e.g. /family/f2/person/p1?color=blue.

Implementation

Future<T?> push<T extends Object?>(String location, {Object? extra}) async {
  assert(() {
    log.info('pushing $location');
    return true;
  }());
  final RouteMatchList matches =
      await _routeInformationParser.parseRouteInformationWithDependencies(
    RouteInformation(location: location, state: extra),
    // TODO(chunhtai): avoid accessing the context directly through global key.
    // https://github.com/flutter/flutter/issues/99112
    _routerDelegate.navigatorKey.currentContext!,
  );

  return _routerDelegate.push<T?>(matches);
}