restartApp static method

Future<void> restartApp(
  1. BuildContext context, {
  2. FutureOr<void> onRestart()?,
})

Restart the application by passing context.

Reload all widgets and states.

You can describe the process at restart by passing onRestart.

contextを渡すことでアプリをリスタートします。

すべてのウィジェットや状態をリロードします。

onRestartを渡すことでリスタート時の処理を記述することができます。

Implementation

static Future<void> restartApp(
  BuildContext context, {
  FutureOr<void> Function()? onRestart,
}) async {
  final state = context.findAncestorStateOfType<_MasamuneAppState>();
  await state?._restart(onRestart);
}