当 运行 作为 MacOS 桌面应用程序时,我在哪里可以找到 shared_preferences 原始 json 文件?

Where can I find the shared_preferences raw json file when running as a MacOS desktop application?

我正在使用众所周知的包 shared_preferences 来存储数据。我是 运行 我的 flutter 应用程序作为 MacOS 桌面应用程序,而不是 Android。我怎样才能访问该文件以查看所存储内容的完整概览?任何帮助将不胜感激。

数据可能会异步持久化到磁盘,无法保证写入返回后会持久化到磁盘,所以此插件不得用于存储关键数据。

我想您可以在 api library.

中找到您想要的一切
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

我想我找到了答案。在终端写

defaults read uk.co.mytestapp