biscuits 2.8.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 82

Biscuits.dart #

Runtime Release License Coverage Build

Service for interacting with the HTTP cookies in Dart.

Documentation #

Development #

License #

Biscuits.dart is distributed under the MIT License.

Changelog #

Version 2.8.0 #

  • Added the putIfAbsent() and putObjectIfAbsent() methods to the Cookies class.
  • Updated the documentation.
  • Updated the package dependencies.

Version 2.7.0 #

  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 2.6.1 #

  • Fixed the issue #2: relaxed the version constraint of the intl dependency.

Version 2.6.0 #

  • Added the CookieOptions.fromString() method.
  • Raised the Dart SDK constraint.
  • Removed the restriction on allowed cookie names.

Version 2.5.0 #

  • Fixed the issue #1: the CookieOptions.maxAge property cannot be set via the constructor.
  • Updated the package dependencies.

Version 2.4.0 #

  • Downgraded the SimpleChange class to a non-generic one.
  • The CookieOptions.maxAge property now returns a null reference for session cookies.
  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 2.3.0 #

  • Added the CookieOptions.maxAge property.
  • Raised the Dart SDK constraint.
  • Using new language features: collection if.
  • Updated the package dependencies.

Version 2.2.0 #

  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 2.1.0 #

  • Updated the package dependencies.
  • Updated the URL of the Git repository.

Version 2.0.0 #

  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 1.3.0 #

  • Updated the package dependencies.

Version 1.2.0 #

  • Updated the package dependencies.

Version 1.1.0 #

  • The Cookies constructor now accepts a Document instance instead of an HtmlDocument one.
  • The SimpleChange class is now generic.
  • Added a defaultValue argument to the get() and getObject() methods of the Cookies class.
  • Added the Cookies.toJson() method.
  • Added new unit tests.

Version 1.0.0 #

  • First stable release.
  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 0.2.0 #

  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 0.1.0 #

  • Initial release.

example/main.dart

// ignore_for_file: avoid_print
import 'dart:convert';
import 'package:biscuits/biscuits.dart';

/// Tests the cookie service.
void main() {
  final cookies = Cookies(defaults: CookieOptions(
    domain: 'domain.com',
    path: '/path',
    secure: true
  ));

  // The defaut options used when a cookie is created or removed.
  print(jsonEncode(cookies.defaults));
  // {"domain": "www.domain.com", "expires": null, "path": "/", "secure": true}

  // Write the cookies.
  print(cookies.containsKey('foo')); // false
  print(cookies.containsKey('baz')); // false
  print(cookies.isEmpty); // true

  cookies['foo'] = 'bar';
  print(cookies.containsKey('foo')); // true
  print(cookies.length); // 1

  cookies.setObject('baz', <String, int>{'qux': 123});
  print(cookies.containsKey('baz')); // true
  print(cookies.length); // 2

  // Read the cookies.
  print(cookies['foo'].runtimeType); // "String"
  print(cookies['foo']); // "bar"

  print(cookies.getObject('baz').runtimeType); // "_JsonMap"
  print(cookies.getObject('baz')); // {"qux": 123}
  print(cookies.getObject('baz')['qux']); // 123

  // Delete the cookies.
  cookies.remove('foo');
  print(cookies.containsKey('foo')); // false
  print(cookies.length); // 1

  cookies.clear();
  print(cookies.containsKey('baz')); // false
  print(cookies.isEmpty); // true
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  biscuits: ^2.8.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:biscuits/biscuits.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
65
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
82
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1

Analysis suggestions

Package not compatible with runtime flutter-native of android

Because of the import of dart:html via the import chain package:biscuits/biscuits.dart->dart:html

Package not compatible with runtime flutter-native of ios

Because of the import of dart:html via the import chain package:biscuits/biscuits.dart->dart:html

Package not compatible with runtime flutter-native of linux

Because of the import of dart:html via the import chain package:biscuits/biscuits.dart->dart:html

Package not compatible with runtime flutter-native of macos

Because of the import of dart:html via the import chain package:biscuits/biscuits.dart->dart:html

Package not compatible with runtime flutter-native of windows

Because of the import of dart:html via the import chain package:biscuits/biscuits.dart->dart:html

Package not compatible with runtime native-aot

Because of the import of dart:html via the import chain package:biscuits/biscuits.dart->dart:html

Package not compatible with runtime native-jit

Because of the import of dart:html via the import chain package:biscuits/biscuits.dart->dart:html

Health suggestions

Fix lib/src/cookie_options.dart. (-0.50 points)

Analysis of lib/src/cookie_options.dart reported 1 hint:

line 31 col 9: DO use curly braces for all flow control structures.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
http_parser ^3.1.4 3.1.4
json_annotation ^3.0.1 3.0.1
Transitive dependencies
charcode 1.1.3
collection 1.14.13
meta 1.1.8 1.2.0
path 1.7.0
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0
Dev dependencies
build_runner ^1.8.1
build_test ^1.0.0
build_web_compilers ^2.9.0
coverage ^0.13.9
coveralls ^5.7.0
grinder ^0.8.4
json_serializable ^3.3.0
test ^1.14.2