injectAssetLicenses method

Future<void> injectAssetLicenses()

Injects licenses to be displayed in the licenses page that aren't pre-included by Flutter upon compilation but are included as assets.

Implementation

Future<void> injectAssetLicenses() async {
  final packageNames = [
    'ebook-reader',
    'ipadic',
    've',
  ];

  for (String packageName in packageNames) {
    String licenseText =
        await rootBundle.loadString('assets/licenses/$packageName.txt');
    LicenseRegistry.addLicense(
      () => Stream<LicenseEntry>.value(
        LicenseEntryWithLineBreaks(<String>[packageName], licenseText),
      ),
    );
  }
}