parseNumberLocale function
Parse/format number with locale (thousands sep, decimals). Roadmap #138–139.
Simple implementation: no full locale data; configurable separators.
Parses a number string with optional thousands separator. decimalSep default '.', groupSep default ','.
Implementation
/// Parses a number string with optional thousands separator. [decimalSep] default '.', [groupSep] default ','.
double? parseNumberLocale(
String input, {
String decimalSep = '.',
String groupSep = ',',
}) {
final String s = input.trim().replaceAll(groupSep, '');
if (decimalSep != '.') {
return double.tryParse(s.replaceAll(decimalSep, '.'));
}
return double.tryParse(s);
}