spotube/lib/helpers/readable-number.dart
Kingkor Roy Tirtho 46b652788f Docs: Producthunt badge
ArtistCard navigate to artist profile support
ArtistProfile details section added
2022-01-23 13:24:17 +06:00

14 lines
449 B
Dart

String toReadableNumber(double num) {
if (num > 999 && num < 99999) {
return "${(num / 1000).toStringAsFixed(1)}K";
} else if (num > 99999 && num < 999999) {
return "${(num / 1000).toStringAsFixed(0)}K";
} else if (num > 999999 && num < 999999999) {
return "${(num / 1000000).toStringAsFixed(1)}M";
} else if (num > 999999999) {
return "${(num / 1000000000).toStringAsFixed(1)}B";
} else {
return num.toString();
}
}