0

I get a String (20.95) from a spreadsheet and need to convert it to Double (20.95).

I tried using the Intl package, using

double.parse(NumberFormat.currency(locale: 'en_US').format(price)

but it always returns the value with a comma.

Error: FormatException: Invalid double 20,95

MData
  • 15
  • 6

1 Answers1

1

The following code replaces the comma with a point and then parses it to a double.

double.parse(yourString.replaceAll(",", ".")),
stonith404
  • 321
  • 2
  • 10