restart method

  1. @override
Future<bool> restart({
  1. required bool killProcess,
})
override

Performs the restart.

killProcess is true for a full process restart and false for a UI-only restart.

Completes with true once the platform has accepted the request.

Implementation

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