LicenseDisplayWithPriority<D>.withStatusPriority constructor

LicenseDisplayWithPriority<D>.withStatusPriority({
  1. required D display,
  2. required LicenseStatus licenseStatus,
})

Constructs thedisplayed license with a priority set by status.

Implementation

factory LicenseDisplayWithPriority.withStatusPriority({
  required D display,
  required LicenseStatus licenseStatus,
}) {
  int priority = 0;
  switch (licenseStatus) {
    case LicenseStatus.approved:
      {
        priority = 1;
        break;
      }
    case LicenseStatus.permitted:
      {
        priority = 1;
        break;
      }
    case LicenseStatus.unknown:
      {
        priority = 2;
        break;
      }
    case LicenseStatus.rejected:
      {
        priority = 5;
        break;
      }
    case LicenseStatus.needsApproval:
      {
        priority = 4;
        break;
      }
    case LicenseStatus.noLicense:
      {
        priority = 3;
        break;
      }
  }
  return LicenseDisplayWithPriority._(display, licenseStatus, priority);
}