Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Http 如何在颤振中使用会话用户?_Http_Dart_Flutter - Fatal编程技术网

Http 如何在颤振中使用会话用户?

Http 如何在颤振中使用会话用户?,http,dart,flutter,Http,Dart,Flutter,我一直在尝试使用dart让用户登录并在Flatter中注册http。不知何故,我想让用户留在应用程序使用会话或cookie。有人试过吗?请退出 到目前为止,它使用非最佳实践(安全方面)来存储敏感数据(会话ID等) 公开发行 dependencies: requests: ^1.0.0 用法: import 'package:requests/requests.dart'; // ... // this will persist cookies await Requests.post

我一直在尝试使用dart让用户登录并在Flatter中注册http。不知何故,我想让用户留在应用程序使用会话或cookie。有人试过吗?

请退出

  • 到目前为止,它使用非最佳实践(安全方面)来存储敏感数据(会话ID等)
公开发行

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会话,请签出


它很容易实现,即使在导航之后也能在页面中持久存在。

什么部分会给您带来麻烦?你需要自己处理饼干。您可以从HTTP响应中读取它们,并将它们与请求一起发送。您可以使用@GünterZöchbauer等工具将它们存储在设备上,感谢我使用shared pref成功地管理了它们:)