BitmapFont.fromFnt constructor Null safety

BitmapFont.fromFnt(
  1. String fnt,
  2. Image page
)

Decode a BitmapFont from the contents of font definition (.fnt) file, and an Image that stores the font map.

Implementation

BitmapFont.fromFnt(String fnt, Image page) {
  final fontPages = {0: page};

  XmlDocument doc;
  fnt = fnt.trimLeft();

  if (fnt.startsWith('<?xml') || fnt.startsWith('<font>')) {
    doc = XmlDocument.parse(fnt);
  } else {
    doc = _parseTextFnt(fnt);
  }

  _parseFnt(doc, fontPages);
}