addFont method Null safety
Registers a font asset to be loaded by this font loader.
The bytes
argument specifies the actual font asset bytes. Currently,
only OpenType (OTF) and TrueType (TTF) fonts are supported.
Implementation
void addFont(Future<ByteData> bytes) {
if (_loaded) {
throw StateError('FontLoader is already loaded');
}
_fontFutures.add(bytes.then(
(ByteData data) => Uint8List.view(data.buffer, data.offsetInBytes, data.lengthInBytes),
));
}