staticIconProvider top-level constant

Object const staticIconProvider

Annotation for classes that only provide static const IconData instances.

This is a hint to the font tree shaker to ignore the constant instances of IconData appearing in the declaration of this class when tree-shaking unused code points from the bundled font.

Classes with this annotation must have only "static const" members. The presence of any non-const IconData instances will preclude apps importing the declaration into their application from being able to use icon tree-shaking during release builds, resulting in larger font assets.

@staticIconProvider
abstract final class MyCustomIcons {
  static const String fontFamily = 'MyCustomIcons';
  static const IconData happyFace = IconData(1, fontFamily: fontFamily);
  static const IconData sadFace = IconData(2, fontFamily: fontFamily);
}

Implementation

const Object staticIconProvider = _StaticIconProvider();