DolDurma
DolDurma

Reputation: 17299

Flutter The const variable 'IconData' must be initialized

I'm trying to use Flutter Icons on our project and after downloading font and dart class i put them into project, but for dart class i get this error

The const variable 'IconData' must be initialized

MyFlutterApp class:

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);
}

how can i resolve this problem ?

Upvotes: 1

Views: 1915

Answers (1)

Richard Heap
Richard Heap

Reputation: 51682

Variable names may not start with a digit. Change it to:

  static const IconData three_d_rotation = const IconData(0xe800, fontFamily: _kFontFam);

Upvotes: 3

Related Questions