flutter_fgbg
0.8.0, released 8 months ago by an unverified publisher
Detects when the Flutter app goes to the background or foreground at the app level.
What it does
Detects true app-level background and foreground events rather than individual Activity or ViewController state changes. Provides a built-in widget and a stream to listen for lifecycle transitions.
AI-written summary of version 0.8.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to detect true app-level background and foreground transitions
- You want to avoid false triggers caused by opening new activities, view controllers, or FaceID prompts
Skip it when
- You only need standard widget binding observations for embedding activities
Strengths
- Avoids false positives from native container changes like FaceID prompts
- Provides both a reactive widget and an event stream
- Includes ignoreWhile API to bypass specific events like image picking
Weaknesses
- Can be triggered by actions like picking an image on newer Android versions that open external apps
- Requires a clean build after adding to integrate native code
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Requires a clean build to integrate the plugin native code into the app.
FGBGNotifier(
onEvent: (event) {
print(event);
},
child: Container(),
)Alternatives
Packages that do the same job and could replace flutter_fgbg.
- flutter_foreground_task
Implement and manage foreground services on Android and iOS platforms.
89Compare - android_alarm_manager_plus
Access Android AlarmManager service and run Dart code in the background.
89Compare - safe_device
Detect jailbreak/root, emulator, mock location and other safety flags on iOS/Android devices.
87Compare - connectivity_wrapper
Provides network-aware widgets and connectivity feedback for Flutter applications.
83Compare
Works with
Packages commonly used together with flutter_fgbg: ones it builds on, ones built on it, and its own family.