app_lifecycle_observer 0.0.2 app_lifecycle_observer: ^0.0.2 copied to clipboard
Flutter lifecycle observer independent of context.
import 'package:app_lifecycle_observer_example/router/router.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerDelegate: goRouter.routerDelegate,
routeInformationParser: goRouter.routeInformationParser,
routeInformationProvider: goRouter.routeInformationProvider,
title: 'AppLifecycleObserver',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
);
}
}