tryLocalizeKwh function

String? tryLocalizeKwh(
  1. double? kwh, {
  2. int fractionDigits = 1,
})

Returns a localized version of the given double with the given fraction digits and 'kwh' suffix.

Returns null if the given kwh is null.

Implementation

String? tryLocalizeKwh(double? kwh, {int fractionDigits = 1}) {
  if (kwh == null) return null;

  return '${kwh.toStringAsFixed(fractionDigits)}kwh';
}