我正在使用众所周知的包shared_preferences
来存储数据。我的flutter应用程序是作为MacOS桌面应用程序运行的,而不是在Android上。如何访问该文件以查看存储内容的良好概述?任何帮助都将不胜感激。
我想我找到了答案。终端写入
defaults read uk.co.mytestapp
数据可以异步持久化到磁盘,并且不能保证在返回后写入会持久化到硬盘,因此此插件不能用于存储关键数据。
我认为你可以在api库中找到你想要的一切。
SharedPreferences prefs = await SharedPreferences.getInstance();
Set<String> keys = prefs.getKeys(); //this will return all the keys stored in your ios disk memory
Object? data = prefs.get(key); //this will return the data for the key you want from your ios disk memory