Package selection guidance compiled from public package information, community data, and project usage.
The in_app_idle_detector package is a cross-platform Flutter plugin that detects user inactivity (idle state) across Android, iOS, Web, macOS, Windows, and Linux. It monitors user interactions such as touch, mouse movements, and keyboard input to determine when the user has been inactive for a specified duration. This enables developers to trigger actions like screen timeouts, session expirations, or automatic logout features. The plugin is lightweight and integrates seamlessly into existing Flutter applications without requiring native code changes.
Use cases
Automatic session timeout
User activity tracking
Idle screen lock
Prevent unauthorized access
Auto-logout after inactivity
Key features
Cross-platform support
Real-time idle detection
Configurable idle duration
No native code required
Simple API integration
Suitable for
Security-sensitive apps
Time-based session management
Kiosk or public terminal apps
Apps requiring user engagement monitoring
Considerations
May consume minor battery on long-running apps
Requires permission on some platforms
Behavior may vary slightly between platforms
Not suitable for high-precision timing needs
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
💤 in_app_idle_detector
A lightweight Flutter plugin that detects user inactivity (idle state) across all platforms: Android, iOS, Web, Windows, macOS, and Linux.
Perfect for banking apps, secure dashboards, or any app that needs to react when the user goes idle.
🔐 Ideal for auto logout, lock screen, and productivity
📦 Installation
dependencies:in_app_idle_detector:^0.0.1
Working Demo
🧑💻 Usage
Initialize the plugin (e.g. inside main())
voidmain() {
runApp(MyApp());
InAppIdleDetector.initialize(
timeout: Duration(seconds: 10), // Set your own duration
onIdle: () {
// Called when user goes idleprint("User is idle");
},
onActive: () {
// Called when user becomes active againprint("User is active");
},
);
}
final timeLeft = InAppIdleDetector.remainingTime;
final idleStatus = InAppIdleDetector.isIdle;
✅ Use Cases
🔒 Auto-logout after inactivity (e.g., in banking apps)
🔐 Lock screen on desktops after idle
⏱️ Countdown timers for session expiration
📉 Inactivity analytics and user behavior tracking
🧪 Platform Support
Platform
Supported
✅ Android
Yes
✅ iOS
Yes
✅ Web
Yes
✅ Windows
Yes
✅ macOS
Yes
✅ Linux
Yes
📚 API Summary
Method Description
initialize(...) Starts the idle detection system
reset() Resets the timer (e.g. after activity)
pause() Temporarily disables tracking
resume() Resumes tracking
isIdle Returns true if currently idle
remainingTime Returns Duration until next idle trigger
💡 Tips
Always use navigatorKey.currentContext for dialogs to ensure it works from anywhere.
You can build a visual countdown using remainingTime and a Timer.periodic.
Support the Project
If you find this plugin helpful, consider supporting its development: