loadFontFromDeviceFileSystem function
Implementation
Future<ByteData> loadFontFromDeviceFileSystem(String name,
{String? ext}) async {
final file = await _localFile(name, ext: ext);
final fileExists = file.existsSync();
if (!fileExists) {
throw Exception("File not exist.");
}
List<int> contents = await file.readAsBytes();
if (contents.isEmpty) {
throw Exception("Contents empty.");
}
return ByteData.view(Uint8List.fromList(contents).buffer);
}