parse method

double parse (
  1. String value,
  2. [String commaDelimiter = ',',
  3. String thousandDelimiter = '.']
)

Implementation

static double parse(String value,
    [String commaDelimiter = ',', String thousandDelimiter = '.']) {
  if (commaDelimiter == thousandDelimiter) {
    throw '"commaDelimiter" and "thousandDelimiter" can not be same';
  }

  if (value == null || value.trim() == '') {
    return null;
  }

  value = value
      .replaceAll('Rp', '')
      .replaceAll(thousandDelimiter, '')
      .replaceAll(commaDelimiter, '.');
  try {
    return double.parse(value);
  } catch (e) {
    return null;
  }
}