route_lifecycle 0.0.5 route_lifecycle: ^0.0.5 copied to clipboard
the route_lifecycle is a new way to manage routes lifecycles.
route_lifecycle #
a new way to manage routes lifecycle.
Route路由生命周期管理插件
install #
Add to pubspec #
dependencies:
route_lifecycle: $latest_version
import in dart code #
import 'package:route_lifecycle/route_lifecycle.dart';
Usage #
/// config navigatorObservers
MaterialApp(
navigatorObservers: [
...
RouteMixin.getRouteLifecycleObserver(),
],
);
/// with RouteMixin<T>
class _HomePageState extends State<HomePage> with RouteMixin<HomePage> {
@override
String getRouteName() {
return "/main";
}
@override
void init() {
super.init();
}
@override
void resume() {
super.resume();
}
@override
void stop() {
super.stop();
}
@override
void inactive() {
super.inactive();
}
}