http - 如何在 flutter 中使用 session 用户?

标签 http dart flutter

我一直在尝试让用户登录并使用 dart 在 flutter 中注册 http。我想以某种方式让用户使用 session 或 cookie 留在应用程序中。有人尝试过吗?

最佳答案

查看 requests

pubspec.yaml

dependencies:
  requests: ^1.0.0

用法:

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); 

关于http - 如何在 flutter 中使用 session 用户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52620895/

相关文章:

visual-studio-code - Flutter Packages 进入 VS Code 失败

events - Flutter - 每次页面更改时运行一个函数

dart - 尝试在滚动条上追加新元素时 ListVIew 项目重复

python - 在 Django 中,如何为每个模板渲染自动设置 "cache-control"?

dart - 用pub解决依赖关系失败

dart - 首先列出Where Bad state : No element

dart - 使用 final/const 而不是 var 如何更有效?

security - rabbitmq-management 插件 HTTP API - 安全问题

javascript - 为什么 node.js 将 '0' 附加到我的 POST 请求中?

http - 通过 HTTP 的 ArangoDB 身份验证