parseDoubleIntoAmount method

String parseDoubleIntoAmount({
  1. int decimals = 2,
})

Implementation

String parseDoubleIntoAmount({ int decimals = 2 }) {
  String parsed = toStringAsFixed(decimals).replaceAll('.', ',');

  final result = parsed.replaceAllMapped(
      RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'), (Match m) => '${m[1]} ');
  return result;
}