characterXAdvance method Null safety

int characterXAdvance(
  1. String ch
)

Get the amount the writer x position should advance after drawing the character ch.

Implementation

int characterXAdvance(String ch) {
  if (ch.isEmpty) {
    return 0;
  }
  final c = ch.codeUnits[0];
  if (!characters.containsKey(ch)) {
    return base ~/ 2;
  }
  return characters[c]!.xadvance;
}