initFont method Null safety

Future<void> initFont(
  1. NetworkFont fontData

Init fontData from network to your application.

This operation'll read font data from cache if it exists. Otherwise download from fontData.url and store it to cache.

Also This operation has unnecessary initialization checker, so call same fontData multiple-time does not repeated.

Note: Currently only support OpenType (OTF) and TrueType (TTF) fonts.


Future<void> initFont(NetworkFont fontData) async {
  if (_initedFont.contains( return;
  late final Future<ByteData> fontBytes = _getFontBytesData(fontData);

  final FontLoader font = FontLoader(;
  await font.load();