I'm using shared_preferences ^2.0.15
. I'm facing webview logout problem. Every time user restart the app, user logout from the webview. I'm trying to save cookies when user login in webview and generate cookies.
So I'm troubling to save in cookies in Shared_Preferences.
我正在使用SHARED_PARESSION^2.0.15。我面临着Webview注销问题。每次用户重新启动应用程序时,用户都会从网页视图中注销。当用户登录Webview并生成Cookie时,我正在尝试保存Cookie。因此,在Shared_Preferences中保存Cookie很麻烦。
final cookies = <dynamic>[].obs;
void saveCookies(dynamic value) async {
final store = await SharedPreferences.getInstance();
store.clear();
cookies.value = value;
await store.setString('cookies', convert.jsonEncode(cookies.toJson())); // Fail to add
}
var cookieList = await _cookieManager.getCookies(url);
saveCookies(cookieList);
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!