cToWeight property
String
get
cToWeight
Converts a numeric value in grams to a human-readable weight representation with the appropriate unit (grams or kilograms).
Returns a formatted string representing the weight, e.g., "750 g" or "1.25 kg".
Implementation
String get cToWeight {
var response = '';
if (this >= 1000) {
response = '${(this / 1000)} kg';
} else {
response = '${(this)} g';
}
return response;
}