cooky 1.0.1

Cooky #

An HTTP Cookies implementation for the client.

Usage #

import 'package:cooky/cooky.dart' as cookie;

setCookie() async {
  cookie.set('key', 'value');
}

See our example/example.dart for a more complete example.

Changelog #

1.0.1 #

  • Minor change: Use DateTime.now().add(maxAge) instead of building the date with DateTime.fromMillisecondsSinceEpoch(/* etc... */)

1.0.0 #

  • Initial commit

example/example.dart

import 'package:cooky/cooky.dart' as cookie;

main() async {
  // Create a session cookie:
  cookie.set('key', 'value');

  // Create a cookie that expires in a week:
  cookie.set('key', 'value', maxAge: new Duration(days: 7));

  // Create a cookie that is valid for a certain path and domain:
  cookie.set('key', 'value', path: '/test', domain: 'test.com');

  // Read a cookie:
  var value = cookie.get('key');
  print(value);

  // Delete a cookie:
  cookie.remove('key');
}

Use this package as a library

1. Depend on it

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


dependencies:
  cooky: ^1.0.1

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:cooky/cooky.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
71
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
25
Overall:
Weighted score of the above. [more]
70
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Fix lib/cooky.dart. (-1.49 points)

Analysis of lib/cooky.dart reported 3 hints:

line 10 col 28: Unnecessary new keyword.

line 61 col 33: Unnecessary new keyword.

line 82 col 18: Unnecessary new keyword.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (intl).

Package is getting outdated. (-51.23 points)

The package was last published 78 weeks ago.

The package description is too short. (-14 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.22.0 <3.0.0
intl ^0.15.7 0.15.8 0.16.1
Transitive dependencies
path 1.6.4
Dev dependencies
grind_publish ^0.0.2
grinder ^0.8.3
test ^1.3.0