創(chuàng)建一個(gè)assets文件夾
單文件添加
assets:
- assets/demo.json
全部當(dāng)前文件夾下資源
assets:
- assets/
- assets/images/
使用
用到了FutureBuilder和DefaultAssetBundle
FutureBuilder(
future: DefaultAssetBundle.of(context).loadString('assets/demo.json'),
builder: (context,snap){
return Container();
},
)