【问题标题】:Flutter SharedPreferences Windows locationFlutter SharedPreferences Windows 位置
【发布时间】:2023-02-19 11:37:13
【问题描述】:

SharedPreferences 在 Windows 上将本地数据保存在哪里?比如路径在哪里?我指的是这个:

final prefs = await SharedPreferences.getInstance();
var myData = prefs.getString('myData');

谢谢

【问题讨论】:

    标签: flutter dart sharedpreferences


    【解决方案1】:

    根据Shared Preferences documentation,它存储在 Windows 的本地 AppData 文件夹中。

    Windows platform interface的代码扫描来看,这似乎是pathProvider.getApplicationSupportPath()获取的路径。您可以在您的代码中调用它来获取文件存储位置的具体路径。

    【讨论】:

    • 打印 getApplicationSupportPath 的值:C:Users[用户名]AppDataRoaming[公司名][项目名]
    【解决方案2】:

    它显然已移至 AppDataLocalPackagesYOURPACKAGELocalCacheRoamingcom.COMPANYNAMEAPPNAME

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-01
      相关资源
      最近更新 更多