talira

cookie_jar

A cookie manager for HTTP requests in Dart

open sourceMITfree

cookie_jar is a Dart package that stores cookies from HTTP responses and returns the right ones for each request, following the standard cookie policy from the RFC. Its default CookieJar keeps cookies in memory until the app exits, and PersistCookieJar saves them to files so they survive restarts. It works in Dart and Flutter apps.

Problems it solves

  • keep a user's session cookies between HTTP requests in my Flutter app
  • persist login cookies to disk so the user stays signed in after restarting the Dart app
  • send the right cookies back to the server with each request in Dart

Features

  • save cookies from responses and load the matching ones for a request
  • in-memory DefaultCookieJar and file-backed PersistCookieJar
  • SerializableCookie for JSON persistence

Alternatives

The same job

These do what cookie_jar does.

  1. dio HTTP client for Dart and Flutter with interceptors, FormData and cancellation

Compare cookie_jar with the top 3