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

A Flutter package for handling idle user logout

๐Ÿ’ค

Idle Logout

Coverage Badge Minimum Dart Version Platform Very Good CLI

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).


Idle Logout Demo


โœจ Features #

  • โฑ๏ธ Detects user inactivity.
  • ๐Ÿšช Logs out automatically after a configurable timeout.
  • ๐Ÿ”„ Resets the timer on user activity.
  • ๐Ÿงฉ Simple and flexible API.

๐Ÿ“ฆ Installation #

Add to your project:

flutter pub add idle_logout

Or manually add to your pubspec.yaml:

dependencies:
  idle_logout: ^0.1.2

๐Ÿš€ Usage #

Basic Example #

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

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: IdleLogout(
        timeout: const Duration(seconds: 10),
        isLoggedIn: () => true, // Replace with your auth logic
        isLockedOut: () => false,
        lockedOutAction: () async {
          debugPrint('User logged out due to inactivity');

          await Navigator.of(context).pushReplacement(
            MaterialPageRoute<void>(
              builder: (BuildContext context) => const OtherScreen(),
            ),
          );
        },
        child: const HomeScreen(),
      ),
    );
  }
}


๐Ÿงช Testing #

This package is set up with Very Good Analysis and Very Good Workflows.

Run tests with:

very_good test --coverage

Generate and view coverage:

genhtml coverage/lcov.info -o coverage/
open coverage/index.html

๐Ÿ“œ License #

Licensed under the MIT License.


2
likes
150
points
52
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for handling idle user logout

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on idle_logout