push method Null safety

void push(
  1. String location,
  2. {Object? extra}
)

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

Implementation

void push(String location, {Object? extra}) {
  assert(() {
    log.info('pushing $location');
    return true;
  }());
  _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!,
  )
      .then<void>((RouteMatchList matches) {
    _routerDelegate.push(matches.last);
  });
}