gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 07:00:03 26 4
gpt4 key购买 nike

我一直在尝试让用户登录并使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com