toNamed method

  1. @override
Future<T?> toNamed(
  1. String page, {
  2. Object? arguments,
  3. String? id,
  4. bool preventDuplicates = true,
  5. Map<String, String>? parameters,
})
override

Navigates to a named page and returns a result of type T.

Implementation

@override
Future<T?> toNamed(
  String page, {
  Object? arguments,
  String? id,
  bool preventDuplicates = true,
  Map<String, String>? parameters,
}) async {
  final PageSettings args = _buildPageSettings(page, arguments);
  final RouteDecoder<T>? route = _getRouteDecoder(args);
  if (route != null) {
    return _push(route);
  } else {
    await goToUnknownPage();
  }
  return null;
}