navigateToNamed method

dynamic navigateToNamed(
  1. String routeName, {
  2. bool replace = false,
  3. Map<String, String>? params,
  4. Map<String, dynamic>? queryParams,
  5. Map<String, dynamic>? extra,
})

Implementation

navigateToNamed(
  String routeName, {
  bool replace = false,
  Map<String, String>? params,
  Map<String, dynamic>? queryParams,
  Map<String, dynamic>? extra,
}) {
  if (navigatorKey.currentContext != null) {
    if (replace) {
      navigatorKey.currentContext!.goNamed(
        routeName,
        extra: extra ?? {},
        params: params ?? {},
        queryParams: queryParams ?? {},
      );
    } else {
      (navigatorKey.currentContext!).goNamed(
        routeName,
        params: params ?? {},
        queryParams: queryParams ?? {},
        extra: extra ?? {},
      );
    }
  }
}