You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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';
}
}
}
The text was updated successfully, but these errors were encountered:
nissaba
changed the title
[BUG] missing MASS unit symbol name
[REQUEST] Unit symbol for normal units
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';
}
}
}
The text was updated successfully, but these errors were encountered: