A most easily usable cookie management library in Dart. With SweetCookieJar, you can easily manage cookie on your application.

Overview

sweet_cookie_jar

A most easily usable cookie management library in Dart!

pub package Dart

1. About

SweetCookieJar is an open-sourced Dart library.
With SweetCookieJar, you can easily manage cookie on your application.

SweetCookieJar is a library that extends the functionality of the official Cookie class. It also works with Responses in the http package, and even if multiple set-cookie are set in the response header, which is a weak point in the http package, SweetCookieJar can manage these cookie information very easily!

No more difficult implementation is needed to handle multiple set-cookie set in response header in Dart. Just pass the Responses to the constructor of SweetCookieJar!

1.1. Introduction

1.1.1. Install Library

With Dart:

 dart pub add sweet_cookie_jar

With Flutter:

 flutter pub add sweet_cookie_jar

1.1.2. Import It

import 'package:sweet_cookie_jar/sweet_cookie_jar.dart';

1.1.3. Use SweetCookieJar

void main() {
    // The cookie set in the response header
    // will be extracted by the constructor process.
    final cookieJar = SweetCookieJar.from(response: response);

    if (cookieJar.isEmpty) {
        // It means that there is no cookie information
        // in the response header.
        return;
    }

    // You can find cookie by name easily.
    final cookie = cookieJar.find(name: 'AWSALB');
    print(cookie.name);
    print(cookie.value);

    // Also you can get cookie as JSON format.
    print(cookie.toJson());

    if (cookie.isExpired) {
        // Do something when cookie is expired.
        return;
    }
}

1.2. License

Copyright (c) 2021, Kato Shinya. All rights reserved.
Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.

1.3. More Information

SweetCookieJar was designed and implemented by Kato Shinya.

You might also like...

A simple to-do list built using flutter based on BLoC state management to manage your daily tasks .

A simple to-do list built using flutter based on BLoC state management to manage your daily tasks .

📝 Table of Contents About ScreenShots from the app Demo vedio Contributors About A to-do list flutter app to manage your daily tasks. it is built bas

Oct 12, 2022

Portarius is a free, open-source, cross-platform mobile application that allows you to manage your Portainer sessions.

Portarius is a free, open-source, cross-platform mobile application that allows you to manage your Portainer sessions.

Portarius [Latin: Porta/Door Arius/Keeper] Features User management See running/stopped containers (and also start/stop and restart them) See containe

Jan 7, 2023

changelog.dart provides a library and a command-line application to manage in the correct way the git metadata to build the changelog between two release

changelog.dart provides a library and a command-line application to manage in the correct way the git metadata to build the changelog between two release

changelog.dart đŸŽ¯ changelog.dart: a collection of tools to manages in a fashion way a repository as maintainer. đŸŽ¯ Project Homepage Table of Content I

Dec 18, 2022

Most popular and easy to use open source UI library with 1000+ Widgets to build flutter app.

Most popular and easy to use open source UI library with 1000+ Widgets to build flutter app.

GetWidget is a 100% free Flutter open-source UI Kit library built with Flutter SDK to make Flutter development easier and more joyful than ever. GetWi

Jan 1, 2023

Most popular and easy to use open source UI library with 1000+ Widgets to build flutter app.

Most popular and easy to use open source UI library with 1000+ Widgets to build flutter app.

GetWidget is a 100% free Flutter open-source UI Kit library built with Flutter SDK to make Flutter development easier and more joyful than ever. GetWi

Jan 3, 2023

QUICKNOTES is a simple Note taking app, you can easily manages your TODOs

QUICKNOTES is a simple Note taking app, you can easily manages your TODOs

QUICKNOTES is a simple Note taking app, you can easily manages your TODOs. It has a simple UI with Dark & Light Themes.

May 2, 2022

dos downloader app is developed for downloading video. You can download video from YouTube and Facebook. You can also play video on background

dosdownloader Dos downloader app is developed for downloading video. You can download video from YouTube and Facebook. You can also play video on back

Dec 8, 2021

A showcase app for the Flutter SDK. Wonderous will educate and entertain as you uncover information about some of the most famous structures in the world.

A showcase app for the Flutter SDK. Wonderous will educate and entertain as you uncover information about some of the most famous structures in the world.

Wonderous Navigate the intersection of history, art, and culture. Wonderous will educate and entertain as you uncover information about some of the mo

Dec 29, 2022

An app that helps you manage your Postcard Creator orders. Built with Flutter

mailman A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Jan 10, 2022
Comments
  • merge two `SweetCookieJar`s

    merge two `SweetCookieJar`s

    I'm working with https://github.com/jossef/requests which does http requests with seamless cookies in between them. I would like to use this package instead of a custom made CookieJar, but SweetCookieJar is lacking a way to edit the cookies inside it.

    So I would like a way to alter the cookies inside a SweetCookieJar (and also a way to merge 2 SweetCookieJars).

    This way a CookieJar can be altered with some newly set cookies by the server, and then resent on a new request.

    enhancement 
    opened by sehnryr 2
  • Exception thrown when cookie values contain invalid characters

    Exception thrown when cookie values contain invalid characters

    Hi, I'm encountering an exception on the SweetCookieJar.from() function when set-cookie header contains invalid characters.

    // r.headers['set-cookie'] contains invalid characters in the cookie sent by server 
    var cookieBin = SweetCookieJar.from(response: r); 
    

    My current workaround is to perform string manipulation on the cookie string to replace those invalid characters..

    opened by A5H1Q 0
Releases(v1.1.0)
  • v1.1.0(May 18, 2022)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/sweet-cookie-jar/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 1.0.4(Dec 18, 2021)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/sweet-cookie-jar/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 1.0.3(Dec 14, 2021)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/sweet-cookie-jar/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 1.0.2(Dec 13, 2021)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/sweet-cookie-jar/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Dec 9, 2021)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/sweet-cookie-jar/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Dec 8, 2021)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/sweet-cookie-jar/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 0.0.3(Dec 8, 2021)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/sweet-cookie-jar/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 0.0.2(Dec 7, 2021)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/sweet-cookie-jar/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 0.0.1(Dec 7, 2021)

Owner
Kato Shinya
Freelance software developer. Web and Batch development in Java. Also mobile development in Flutter.
Kato Shinya
A most easily usable RESAS API wrapper in Dart. With this library, you can easily integrate your application with the RESAS API.

A most easily usable RESAS API wrapper library in Dart! 1. About 1.1. What Is RESAS? 1.2. Introduction 1.2.1. Install Library 1.2.2. Import It 1.2.3.

Kato Shinya 2 Apr 7, 2022
A most easily usable Duolingo API wrapper in Dart. Duolingo4D is an open-sourced Dart library.

A most easily usable Duolingo API wrapper in Dart! 1. About Duolingo4D Duolingo4D is an open-sourced Dart library. With Duolingo4D, you can easily int

Kato Shinya 18 Oct 17, 2022
A most easily usable JSON wrapper library in Dart

A most easily usable JSON response wrapper library in Dart! 1. About 1.1. Introd

Kato Shinya 2 Jan 4, 2022
A most easily usable improvement rate calculator library in Dart.

A most easily usable improvement rate calculator library in Dart. With ImprovementRate, you can easily calculate improvement rate on your application.

Kato Shinya 1 Dec 27, 2021
AuthorizationHeader is an open-sourced Dart library. With AuthorizationHeader, you can easily manage authorization header on your application.

A most easily usable authorization header management library in Dart! 1. About 1.1. Supported 1.1.1. Authorization Header 1.1.2. Authorization Type 1.

Kato Shinya 3 Dec 24, 2021
This package will help you to manage the overlays in your projects. Show a dialog, notification, window, or a panel easily

This package will help you to manage the overlays in your projects. Show a dialog, notification, window, or a panel easily. or use one of the helping widgets like AutoComplete, Expander(Dropdown).

Schaban Bochi 25 Dec 4, 2022
A Flutter widget that checks and displays the version status of application and you can easily guide user to update your app

A most easily usable Flutter widget about application version check! 1. About 1.

Kato Shinya 1 Dec 16, 2021
Flutter The lightest, easiest and most convenient route management!

Language: English | 中文įŽ€äŊ“ nav_router nav_router is the simplest / lightweight / convenient routing management solution for flutter. It supports various

FlutterCandies 104 Jan 3, 2023
GetX - one of the most popular state management solution in flutter

GteX Tutorial - Udemy GetX is one of the most popular state management solution in flutter. In addition to state management, GetX provides easy way to

Md. Siam 3 May 18, 2022