大佬教程收集整理的这篇文章主要介绍了如何在Flutter Mobile App中加载和查询本地json数据,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
将您的JsON文件添加到 pubspec.yaml
assets:
- assets/config.Json
然后可以使用rootBundle
它加载
import 'dart:async' show Future;
import 'package:Flutter/services.dart' show rootBundle;
Future<String> loadAsset() async {
return await rootBundle.loadString('assets/config.Json');
}
还请看一下完整的示例, 并进行查询以将您的JsON数据转换为LIST,然后您就有了很多搜索方法,例如where方法
这是我的 key:value 成对的本地json。我需要加载,以后再用于查询。那么,如何在Flutter Mobile
App中加载和查询本地json数据?
{
"currency.01": "United State USD","currency.17": "British Pound GBP","currency.33": "Euro EUR",}
以上是大佬教程为你收集整理的如何在Flutter Mobile App中加载和查询本地json数据全部内容,希望文章能够帮你解决如何在Flutter Mobile App中加载和查询本地json数据所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。