restart method

  1. @override
Future<bool> restart()
override

Kills the process and cold-starts the app.

Completes with true once the platform has accepted the request.

Implementation

@override
Future<bool> restart() async {
  try {
    // Reload in a microtask so this Future completes first.
    // `location.replace(sameUrl)` does not reload in most browsers, so
    // use `reload()`.
    scheduleMicrotask(() => web.window.location.reload());
    return true;
  } catch (_) {
    return false;
  }
}