flutter http json with cookies

a flutter library to do modern http requests with cookies(inspired by python's requests module).

server side cookies (via response header SET-COOKIE) are stored using the assistance of shared_preferences. Stored cookies will be send seemlessly on the next http requests you make to the same domain (simple implementation, similar to a web browser)


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

  requests: ^1.0.1


in your Dart code, you can use:

import 'package:requests/requests.dart';

HTTP get, body as plain text

String body = await Requests.get("https://mydomain.com");

HTTP get, body as parsed json

dynamic body = await Requests.get("https://mydomain.com/api/v1/foo", json: true);

HTTP post, body is json, result is json

dynamic body = await Requests.post("https://mydomain.com/api/v1/foo", json: true, body: {"foo":"bar"} );

HTTP delete

await Requests.delete("https://mydomain.com/api/v1/foo/123");