这只是个问题记录,我会把自己的每次遇到的问题集中起来
· flutter dart:convert 导入JSON失效
是的,我在Flutter中文官网上看到的是
import 'dart:convert';
[...]
widgets = JSON.decode(response.body)
我发现JSON那个使用起来报错,原因:json在新版flutter中升级了,由大写改成小写了。全部改小写json就对了。
感谢此博主的贡献
· 使用字体
* 然后导入到项目里,如在项目根目录下新建fonts文件夹,把下载的iconfont.ttf放入文件夹中
* 然后在pubspec.yaml中添加
* fonts:
- family: aliIcon 名称,随意命名
fonts:
- asset: fonts/iconfont.ttf 字体库路径
* 接着将IconFont的Unicode引用  改为 0xe8e8 添加到IconData,fontFamily值为上面定义的aliIcon即可。
使用:
// declare the text style
const textStyle = const TextStyle(
fontFamily: 'Raleway',
);
// use the text style
var buttonText = const Text(
"Use the font for this text",
style: textStyle,
);