app_restarter
0.2.0, released 12 months ago by an unverified publisher
Programmatically restart your Flutter application with callbacks, animations, and advanced control.
WASM-ready
What it does
AppRestarter allows you to restart a Flutter application programmatically by wrapping the root widget and calling a static restart function. It supports custom transition animations, delays, conditional logic, and lifecycle callbacks for cleanup and re-initialization.
AI-written summary of version 0.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to completely reset the application state and widget tree, such as on user logout or language change.
- You want custom transition animations or a delay when restarting the app.
- You need to run asynchronous initialization or cleanup logic before or after a restart.
Skip it when
- You only need to rebuild a single screen or local widget subtree.
- You prefer terminating the native OS process instead of resetting the Flutter widget tree.
Strengths
- Zero dependencies and pure Flutter implementation.
- Supports custom animations, delayed restarts, and conditional execution.
- Includes async lifecycle callbacks for state cleanup and service re-initialization (e.g. GetX).
Weaknesses
- Does not terminate the underlying OS process; it only forces a rebuild from the root widget using KeyedSubtree.
- Requires manual re-initialization of global dependencies (like GetX services) after a restart.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Wrap your root widget (above MaterialApp or CupertinoApp) with the AppRestarter widget.
void main() {
runApp(
AppRestarter(
child: MyApp(),
),
);
}
// To restart:
AppRestarter.restartApp(context);