glossLoadFonts function
Loads the face Gloss bundles, so the first frame is set in it. Await it
before runApp: on the web a bundled face otherwise arrives after the
first frames, which flash in a fallback face.
Future<void> main() async {WidgetsFlutterBinding.ensureInitialized(); await glossLoadFonts(); runApp(const Placeholder());}
Implementation
Future<void> glossLoadFonts() {
final loader = FontLoader(glossRegisteredFamily(glossFontFamily))
..addFont(
rootBundle.load(
glossFontPackage == null
? 'assets/fonts/PlusJakartaSans.ttf'
: 'packages/$glossFontPackage/assets/fonts/PlusJakartaSans.ttf',
),
);
return loader.load();
}