FormatException (FormatException: Invalid double ) len8657 2020-10-26 1,268 阅读1分钟 try { var n = double.parse('n4wer2'); print(n); } on FormatException { print('Format error!'); } flutter 字符串转浮点数时,字符串包含除了数字之外的字母,导致FormatException (FormatException: Invalid double ) 解决方法 var n = double.parse('n4wer2', (source) => 1);