packageLicenseStatus property
Future<LicenseStatus>
get
packageLicenseStatus
Returns the license status of the package.
Implementation
Future<LicenseStatus> get packageLicenseStatus async {
String lname = await licenseName;
// No file found
if (lname == noFileLicense) {
// Check approved packages
return _checkApprovedPackages(noFileLicense) ?? LicenseStatus.noLicense;
}
if (lname == unknownLicense) {
return LicenseStatus.unknown;
}
// Check different cases defined in the config
return Future.value(
_checkLicense(
lname,
config.permittedLicenses,
LicenseStatus.permitted,
) ??
_checkLicense(
lname,
config.rejectedLicenses,
LicenseStatus.rejected,
) ??
_checkApprovedPackages(lname) ??
LicenseStatus.needsApproval,
);
}