idle_logout 0.1.2 copy "idle_logout: ^0.1.2" to clipboard
idle_logout: ^0.1.2 copied to clipboard

A Flutter package for handling automatic user logout after a period of inactivity. Ideal for apps where session security and compliance are important (e.g., banking, healthcare, enterprise apps).

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:idle_logout/idle_logout.dart';

import '../../screens/home_screen.dart';
import 'screens/lock_screen.dart';

final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return IdleLogout(
      pauseThreshold: const Duration(seconds: 15),
      timeout: const Duration(seconds: 10),
      isLoggedIn: () => true,
      isLockedOut: () => false,
      lockedOutAction: () async {
        debugPrint('User logged out due to inactivity');

        navigatorKey.currentState?.pushReplacement(
          MaterialPageRoute<void>(
            builder: (BuildContext context) => const LockScreen(),
          ),
        );
      },
      child: MaterialApp(navigatorKey: navigatorKey, home: const HomeScreen()),
    );
  }
}
3
likes
0
points
80
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for handling automatic user logout after a period of inactivity. Ideal for apps where session security and compliance are important (e.g., banking, healthcare, enterprise apps).

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on idle_logout