The application lifecycle describes the host application’s relationship to its platform and views. It is separate from whether one route is covered by another.
The original observer was:
import 'package:flutter/material.dart';
import 'package:nft/utils/app_log.dart';
class HomePage extends StatefulWidget {
const HomePage({Key key}) : super(key: key);
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage>
with WidgetsBindingObserver {
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
/// Log app life cycle state
logger.d(state);
}
@override
Widget build(BuildContext context) {
return Container();
}
}
Its earlier interaction trace was:
- App is opening
- Press home
flutter: [D] AppLifecycleState.inactive
flutter: [D] AppLifecycleState.paused
- Open app by tap on app icon
flutter: [D] AppLifecycleState.inactive
flutter: [D] AppLifecycleState.resumed
- In recent application (double home tap on iPhone)
flutter: [D] AppLifecycleState.inactive
- Kill app from recent application
flutter: [D] AppLifecycleState.paused
The note also recorded this explanation of detached:
When the application is in this state, the engine is running without a view. It can either be in the progress of attaching a view when engine was first initializes, or after the view being destroyed due to a Navigator pop. -Flutter-
An engine without an attached view is not the same thing as an ordinary screen losing route focus. Platform behavior and available lifecycle states vary by framework generation. Registration, removal, and the owning state’s lifetime should be reviewed together. No foreground/background transitions were generated for this revision.