licenseName property

Future<String> get licenseName

The license name associated with the package

Implementation

Future<String> get licenseName async {
  if (licenseFile == null) {
    return noFileLicense;
  }

  String content = await licenseFile!.readAsString();
  pana_license_detector.Result res =
      await pana_license_detector.detectLicense(content, 0.9);
  // Just the first match (highest probability) as the license.
  return res.matches.isNotEmpty
      ? res.matches.first.identifier
      : unknownLicense;
}