Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] Unit symbol for normal units #51

Open
nissaba opened this issue Aug 23, 2024 · 1 comment
Open

[REQUEST] Unit symbol for normal units #51

nissaba opened this issue Aug 23, 2024 · 1 comment

Comments

@nissaba
Copy link

nissaba commented Aug 23, 2024

I was using MASS and when I tryed to get MASS.pounds.symbol it gave me a warnign that the property did not exist.
I fixed it by vreating an extension, possilby youi can re-use it in the project.

extension on MASS {
String get symbol => _symbol();
String _symbol() {
switch (this) {
case MASS.kilograms:
return 'kg';
case MASS.grams:
return 'k';
case MASS.ettograms:
return 'hg';
case MASS.pounds:
return 'lbs';
case MASS.ounces:
return 'oz';
case MASS.quintals:
return 'q';
case MASS.tons:
return 't';
case MASS.milligrams:
return 'mg';
case MASS.femtograms:
return 'fg';
case MASS.picograms:
return 'pg';
case MASS.nanograms:
return 'ng';
case MASS.micrograms:
return 'μg';
case MASS.decigrams:
return 'dg';
case MASS.uma:
return 'u';
case MASS.carats:
return 'ct';
case MASS.centigrams:
return 'cg';
case MASS.pennyweights:
return 'dwt';
case MASS.troyOunces:
return 'ozt';
case MASS.stones:
return 'st';
}
}
}

@nissaba nissaba changed the title [BUG] missing MASS unit symbol name [REQUEST] Unit symbol for normal units Aug 23, 2024
@nissaba
Copy link
Author

nissaba commented Aug 23, 2024

I see it is missing for all supported unit types. it would be very usefull to have this in the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant