session_jar 0.0.4 copy "session_jar: ^0.0.4" to clipboard
session_jar: ^0.0.4 copied to clipboard

A simple server side package for creating and maintaining sessions in dart.

Session Jar #

A simple server side package for creating and maintaining sessions in dart.

Usage #

import 'package:session_jar/session_jar.dart';

void main() {
  //create a session jar
  var sessionJar = SessionJar();

//add a session to your sessionjar
  var newSession =
      sessionJar.create('username', expiresIn: Duration(hours: 12));

//send your session back to the client as a cookie
  var cookie = newSession.cookie;
  print(newSession.cookie);

//get a session from a cookie
  var sessionFromRequest = sessionJar.fromCookie(cookie);

  //do something with your session data
  print(sessionFromRequest?.body ?? 'session not found!');
}

To do: #

  • Every session has its own expiration timer. this is not efficient in large projects. So I will improve the automatic session deletion in the future.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1
likes
140
pub points
0%
popularity

Publisher

unverified uploader

A simple server side package for creating and maintaining sessions in dart.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

More

Packages that depend on session_jar