Reputation: 777
I've been trying to make user login and register with http in flutter using dart. Somehow i want to make user stay at the app using session or cookie. Anyone have been trying it yet?
Upvotes: 10
Views: 27393
Reputation: 3670
If you are looking for a user session instead of HTTP session, check out flutter_session.
It's really easy to implement and persists through pages even after navigating.
Upvotes: 2
Reputation: 34237
Check out requests
pubspec.yaml
dependencies:
requests: ^1.0.0
Usage:
import 'package:requests/requests.dart';
// ...
// this will persist cookies
await Requests.post("https://example.com/api/v1/login", body: {"username":"...", "password":"..."} );
// this will re-use the persisted cookies
dynamic data = await Requests.get("https://example.com/api/v1/stuff", json: true);
Upvotes: 3