Simple widget to restart your flutter application.
- Add
RestartWidget
at the root of your widget tree.
import 'package:flutter/material.dart';
import 'package:flutter_restart/flutter_restart.dart';
void main() {
runApp(
RestartWidget(
child: MyApp(),
),
);
}
- From anywhere inside your application call
restartApp
.
RestartWidget.of(context).restartApp();
RestartWidget
is an InheritedWidget
that provides the restartApp
function, which when called rebuilds the entire widget tree.
Package built from Rémi Rousselet
's answer on StackOverflow.