How to POST in Flutter with cookie or session? How to POST in Flutter with cookie or session? dart dart

How to POST in Flutter with cookie or session?


Check out requests

  • as of now, it uses shared_preferences which is not the best practice (security-wise) to store sensitive data (session-ids etc) Issue #1

pubspec.yaml

dependencies:  requests: ^1.0.0

Usage:

import 'package:requests/requests.dart';ajaxPost() async {    // this will persist cookies    await Requests.post("http://example.com/app/oauth/authorize", body: {"username":"...", "password":"..."} );     // next requests will re-use the persisted cookies    dynamic data = await Requests.get("http://example.com/app/foo", json: true); }