我正在尝试在项目中使用Flutter Icons
,并在下载字体和dart类后将它们放入项目中,但是对于dart类,却出现此错误
The const variable 'IconData' must be initialized
MyFlutterApp
类:
class MyFlutterApp {
MyFlutterApp._();
static const _kFontFam = 'MyFlutterApp';
static const IconData 3d_rotation = const IconData(0xe800, fontFamily: _kFontFam);
static const IconData ac_unit = const IconData(0xe801, fontFamily: _kFontFam);
static const IconData access_alarm = const IconData(0xe802, fontFamily: _kFontFam);
}
我该如何解决这个问题?
答案 0 :(得分:2)
变量名称不能以数字开头。更改为:
static const IconData three_d_rotation = const IconData(0xe800, fontFamily: _kFontFam);