http_session 0.2.2 copy "http_session: ^0.2.2" to clipboard
http_session: ^0.2.2 copied to clipboard

This plugin helps you easier to manage the sessions when using http to requests.

Http Session #

If you want to login to a web service and keep comunicate with it, you need to save the session and use it for all the requests. This plugin will help you to do that.

Features #

Create an instance of http and manage the session.

Usage #

Use shared session across the application:

final httpSession = HttpSession.shared;

Or create a new session instance:

final httpSession = HttpSession(
    // Set this to `true` if you want to accept the bad certificate (Be CAREFUL when doing this).
    acceptBadCertificate: false,

    // Set maximum number of redirects.
    maxRedirects: 15,
);

Now you can requests any URI and the plugin will automatically save the session:

final response = await httpSession.post(url, body: data);
final response = await httpSession.get(url);

Clear the current session:

httpSession.clear();

Close the current http and also clear the session:

httpSession.close();

If you would like to access current cookie store directly, you can do so:

final CookieStore cookies = httpSession.cookieStore;

See the cookie_store documentation for details of the Cookie_Store class.

0
likes
150
points
59
downloads

Publisher

unverified uploader

Weekly Downloads

This plugin helps you easier to manage the sessions when using http to requests.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

cookie_store, http

More

Packages that depend on http_session