Easy to use session wrapper that adds support to session storage and management in flutter.

Overview

flutter_session_manager

Adds an easy to use wrapper to session management in flutter. Allows for easy session storage and management. The session persists in the app's' lifetime.

Store values in the session:

await SessionManager().set("key", value);

or

var sessionManager = SessionManager();
await sessionManager.set("name", "cool user");
await sessionManager.set("id", 3);
await sessionManager.set("measure", 23.2);
await sessionManager.set("isLoggedIn", true);
await sessionManager.set("user", new User(id: 1, name: "John", isCool: true, postCount: 4));

Read values from the session:

dynamic id = await SessionManager().get("id");

Saving objects:

To save objects, the class must have the toJson() method. When getting a object, it returns as a Json that you can Serialize using fromJson() method.

class User {
  final int id;
  final String name;
  final bool isCool;
  final int postCount;

  User({this.id, this.name, this.isCool, this.postCount});

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> user = Map<String, dynamic>();
    user["id"] = id;
    user["name"] = this.name;
    user["isCool"] = this.isCool;
    user["postCount"] = this.postCount;
    return user;
  }
}

User user = User(id: 1, name: "John", isCool: true, postCount: 4);
await SessionManager().set('user', user);
User u = User.fromJson(await SessionManager().get("user"));

Session Management:

This package contains all operations that may be necessary to manage a session.

  • Update session
await SessionManager().update();
  • Delete session and all data in it
await SessionManager().destroy();
  • Remove a specific item
await SessionManager().remove("id");
  • Verify wether or not a key exists
await SessionManager().containsKey("id"); // true or false

Getting Started

With Flutter, run:

 $ flutter pub add flutter_session_manager

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

 dependencies:
  flutter_session_manager: ^1.0.1

To import it in your Dart code, you can use:

import 'package:flutter_session_manager/flutter_session_manager.dart';

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create.

  1. Fork the Project

  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)

  3. Commit your Changes (git commit -m 'Add some AmazingFeature')

  4. Push to the Branch (git push origin feature/AmazingFeature)

  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Copyright (c) Eduardo Migueis 2021.

You might also like...

Volt is a wrapper over the Revolt API for easily writing bots using the Dart language.

Volt is a wrapper over the Revolt API for easily writing bots using the Dart language. It is currently in active development so not all of the functionality has yet been implemented.

Dec 13, 2022

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

Oct 8, 2021

Queen support for localization in flutter

Queen support for localization in flutter

Nations 🌍 Features translation without context 🚀 custom configuration value not found builder fallback locale supported locales fall back to base be

Jun 22, 2022

Flutter Map plugin for ArcGIS Esri. Currently support feature layer (point, polygon)

Flutter Map plugin for ArcGIS Esri Currently support feature layer(point, polygon, polyline coming soon) We are working on more features A Dart implem

Nov 9, 2022

A generator to create config class from json files that support many environments

A generator to create config class from json files that support many environments. Motivation If you use a json file to config your applications, perp

Oct 9, 2021

library to help you create database on local memory, support json local database inspired by lowdb

Licensed Licensed under the MIT License http://opensource.org/licenses/MIT. SPDX-License-Identifier: MIT Copyright (c) 2021 Azkadev http://github.c

Oct 17, 2022

Log snapshot management solution (iOS/Android/Web/Server) built with Flutter/Dart using Bloc pattern and Firebase Firestore backend.

Log snapshot management solution (iOS/Android/Web/Server) built with Flutter/Dart using Bloc pattern and Firebase Firestore backend.

Log snapshot management solution (iOS/Android/Web/Server) built with Flutter/Dart using Bloc pattern and Firebase Firestore backend.

Nov 9, 2022

Flutter Version Management: A simple CLI to manage Flutter SDK versions.

Flutter Version Management: A simple CLI to manage Flutter SDK versions.

fvm Flutter Version Management: A simple cli to manage Flutter SDK versions. FVM helps with the need for a consistent app builds by allowing to refere

Jan 8, 2023

My Personal Flutter State Management

trigger Trigger is a Flutter state management Getting Started This project is a starting point for a Flutter library. A few resources to get you start

Dec 12, 2021
Releases(v1.0.3)
  • v1.0.3(Nov 12, 2021)

  • v1.0.1(Nov 12, 2021)

    Basic wrapper with all major methods to session was added depending on the shared_preferences package for flutter. Operations available:

    • Get
    • Set
    • Contains key
    • Update
    • Remove
    • Destroy
    Source code(tar.gz)
    Source code(zip)
Owner
Eduardo Migueis
IT student in the University of Campinas Technical High School
Eduardo Migueis
A flutter plugin that provides external storage path and external public storage path

ext_storage ext_storage is minimal flutter plugin that provides external storage path and external public storage path

null 0 Nov 16, 2021
Minimal Dart wrapper to interact with Some Random Api. Easy to use, simplified and lightweight.

SRA - Some Random Api Minimal Dart wrapper to interact with Some Random Api. Easy to use, simplified and lightweight. Getting started Add the package

Yakiyo 3 Jan 4, 2023
Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Luke Pighetti 3.5k Jan 4, 2023
Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.

Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.

Google 905 Jan 2, 2023
Library for help you make userbot or bot telegram and support tdlib telegram database and only support nodejs dart and google-apps-script

To-Do telegram client dart ✅️ support multi token ( bot / userbot ) ✅️ support bot and userbot ✅️ support telegram-bot-api local server ✅️ support tel

Azka Full Snack Developer:) 73 Jan 7, 2023
Let's Encrypt support for the shelf package (free and automatic HTTPS certificate support).

shelf_letsencrypt shelf_letsencrypt brings support for Let's Encrypt to the shelf package. Usage To use the LetsEncrypt class import 'dart:io'; impor

Graciliano Monteiro Passos 8 Oct 31, 2022
An example todo list back end project that uses gRPC for client-server communication and Firestore for data storage

An example todo list back end project that uses gRPC for client-server communication and Firestore for data storage

Lucas Coelho 2 Apr 18, 2022
Easy to use cross-platform regex replace command line util

replace Easy to use cross-platform regex replace command line util. Can't remember the arguments to the find command? or how xargs works? Maybe sed is

Rob Becker 3 Feb 1, 2022
Dart wrapper via dart:ffi for https://github.com/libusb/libusb

libusb Dart wrapper via dart:ffi for https://github.com/libusb/libusb Environment Windows(10) macOS Linux(Ubuntu 18.04 LTS) Usage Checkout example Fea

Woodemi Co., Ltd 28 Dec 20, 2022
A simple flexible API wrapper for coinbase commerce API. Totally unofficial.

coinbase_commerce A dart library that connects to interact with the Coinbase Commerce API. Enables projects to connect seamlessly to coinbase and rece

Onuoha Obinna 3 Oct 17, 2021