restart method
Future<bool>
restart({
- required bool killProcess,
- required bool wipeData,
- required bool keepSecureStorage,
- required bool keepPreferences,
override
Performs the restart.
killProcess:truefor a full process restart,falsefor a UI-only restart.wipeData: delete app data before restarting.keepSecureStorage: when wiping, keep keychain / secure storage.keepPreferences: when wiping, keep preferences (UserDefaults, SharedPreferences, localStorage).
Completes with true once the platform has accepted the request.
Implementation
@override
Future<bool> restart({
required bool killProcess,
required bool wipeData,
required bool keepSecureStorage,
required bool keepPreferences,
}) async {
try {
if (wipeData) {
await _wipeBrowserData(
keepSecureStorage: keepSecureStorage,
keepPreferences: keepPreferences,
);
}
// 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;
}
}