extracted reusable helper methods into global extensions.

This commit is contained in:
Faris Armoush
2025-04-30 15:02:22 +03:00
parent 63718185e7
commit 9431dd4500
3 changed files with 33 additions and 30 deletions

View 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';
}
}