mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
extracted reusable helper methods into global extensions.
This commit is contained in:
6
lib/pages/analytics/helpers/format_number_to_kwh.dart
Normal file
6
lib/pages/analytics/helpers/format_number_to_kwh.dart
Normal file
@ -0,0 +1,6 @@
|
||||
extension FormatNumberToKwh on num {
|
||||
String get formatNumberToKwh {
|
||||
final regExp = RegExp(r'(\d)(?=(\d{3})+$)');
|
||||
return '${toStringAsFixed(0).replaceAllMapped(regExp, (match) => '${match[1]},')} kWh';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user