requests 2.0.1 copy "requests: ^2.0.1" to clipboard
requests: ^2.0.1 copied to clipboard

outdated

A starting point for Dart libraries or applications.

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)

Install #

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

dependencies:
  requests: ^2.0.1

Usage #

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 map or a list (being sent as application/x-www-form-urlencoded, until stated otherwise in bodyEncoding parameter), 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");
101
likes
20
pub points
91%
popularity

Publisher

unverified uploader

A starting point for Dart libraries or applications.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

crypto, flutter, hex, http, logging, shared_preferences

More

Packages that depend on requests