Skip to content

The session-manager-package for Flutter can still be useful for managing session data related to user interaction in your application. For example, you could use the package to store data such as user preferences, settings, or other information that needs to be persisted across different user session

License

Notifications You must be signed in to change notification settings

Riki1200/session-manager-package

Repository files navigation

Session Manager

The session_manager package provides a set of widgets and functionalities designed to manage user sessions in a Flutter application. It includes a SessionActivityManager widget that handles user inactivity time and calls the corresponding callback functions when the user session expires or there is user activity.

Usage

To use session_manager, add the package as a dependency in your pubspec.yaml file:

To use session_manager, add the package as a dependency in your pubspec.yaml file:

dependencies:
  session_manager: ^0.0.4

In your Dart code, import the session_manager library:

   import 'package:session_manager/session_manager.dart';

Then, wrap your root widget with the SessionActivityManager widget and specify the required parameters:

   class MyApp extends StatelessWidget {
     @override
     Widget build(BuildContext context) {
       return SessionActivityManager(
         onSessionExpired: () {
           // Handle session expiration
         },
         sessionTimeout: Duration(minutes: 5),
         onSessionActivity: () {
            // handle session activity
         },
         
         child: MaterialApp(
           title: 'My App',
           home: MyHomePage(),
         ),
       );
     }
   }

In this example, SessionActivityManager wraps a MaterialApp widget as the child, and the onSessionExpired callback function is specified to handle the expiration of the user session.

Versioning The current version of session_manager is ^0.0.4.

We use semantic versioning to manage package versions. In short, the version number is in the format of MAJOR. MINOR. PATCH, where:

MAJOR is incremented when there are breaking changes MINOR is incremented when new features are added PATCH is incremented when bugs are fixed or minor changes are made For more information, please refer to the changelog for this package.

About

The session-manager-package for Flutter can still be useful for managing session data related to user interaction in your application. For example, you could use the package to store data such as user preferences, settings, or other information that needs to be persisted across different user session

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published