open<T extends Object?> method

Future<T?> open<T extends Object?>(
  1. String path, [
  2. RouteQuery? query
])

Open a new URL or screen.

If path starts with http, it opens a browser, otherwise it opens a screen path.

It is possible to configure the settings for opening the screen by specifying query.

Implementation

Future<T?> open<T extends Object?>(String path, [RouteQuery? query]) async {
  if (path.startsWith("http")) {
    await openURL(path);
    return null;
  } else {
    return await navigator.pushNamed(path, arguments: query);
  }
}