import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'app_font.dart'; bool _registered = false; /// Adds each bundled interface font's SIL Open Font License to the /// [LicenseRegistry]. The texts are read from the bundle only when a licence /// page asks for them. void registerAppFontLicenses() { if (_registered) return; _registered = true; LicenseRegistry.addLicense(() async* { for (final font in AppFont.values) { final asset = font.licenseAsset; if (asset == null) continue; yield LicenseEntryWithLineBreaks([ font.label, ], await rootBundle.loadString(asset)); } }); }