Easily restart your application from scratch, losing any previous state.
From 1.1.0 and onwards, flutter_phoenix is targeting SDK 2.17.0 minimum. If you want to keep using flutter_phoenix but cannot migrate to Dart SDK 2.17.0 yet, use the version 1.0.0 instead.
From 1.0.0 and onwards, flutter_phoenix is null-safe and requires Dart SDK 2.12.0 minimum.
If you want to keep using flutter_phoenix but cannot migrate to null-safety yet, use the version 0.1.0 instead.
Wrap you App widget in the Phoenix
widget.
void main() {
runApp(
Phoenix(
child: App(),
),
);
}
Call the rebirth
static method when you want to restart your application (rebuild the entire widget tree from scratch).
Phoenix.rebirth(context);
Disclaimer :
Phoenix restarts your application at the application level, rebuilding your application widget tree from scratch, losing any previous state.
Phoenix does not fully restart your application process at the OS level.
Here is a non-exhaustive list of use cases where Phoenix
can help :
Add the package as a dependency in your pubspec.yaml file.
dependencies:
flutter_phoenix: "^1.0.0"
Import the package in your code file.
import 'package:flutter_phoenix/flutter_phoenix.dart';
Flutter Phoenix is released under the MIT License
This package is an extract of @rrousselGit answer on this stackoverflow post
As of July 2022, this package is maintained by the front team working on the french mobile application Dailyn