mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: handle situation that font file not existing
This commit is contained in:
@@ -119,8 +119,10 @@ Future<void> loadFontFile(String localPath) async {
|
||||
if (localPath.isEmpty) return;
|
||||
final name = getFileName(localPath);
|
||||
if (name == null) return;
|
||||
final file = File(localPath);
|
||||
if (!await file.exists()) return;
|
||||
var fontLoader = FontLoader(name);
|
||||
fontLoader.addFont(File(localPath).readAsBytes().byteData);
|
||||
fontLoader.addFont(file.readAsBytes().byteData);
|
||||
await fontLoader.load();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user