Skip to content

[new-unit] can you impliment "AM/PM" and "24H" converter , also , can you directly map the enum with symbol through extension . #47

@talpx0

Description

@talpx0

Description
Add here a brief explanation to which units should be added and possibly why (e.g. they are often used in a specific job). We know that there are a ton of unit of measurement that are not yet added to this app. We want to have just the most used one.

enum TEMPERATURE {
  fahrenheit,
  celsius,
  kelvin,
  reamur,
  romer,
  delisle,
  rankine,
}

extension TemperatureExtension on TEMPERATURE {
  String get symbol {
    switch (this) {
      case TEMPERATURE.fahrenheit:
        return '°F';
      case TEMPERATURE.celsius:
        return '°C';
      case TEMPERATURE.kelvin:
        return 'K';
      case TEMPERATURE.reamur:
        return '°Re';
      case TEMPERATURE.romer:
        return '°Rø';
      case TEMPERATURE.delisle:
        return '°De';
      case TEMPERATURE.rankine:
        return '°R';
      default:
        return '';
    }
  }
}

this can make code become much simple , you can directly do "Temperature. fahrenheit.symbol"
thanks , nice work

                |

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions