The method 'toStringDeep' isn't defined for the class 'NumberFormat'

时间:2019-04-17 01:29:55

标签: dart flutter

My app was working perfectly and suddenly it started showing me compiler error. Here is the error:

Compiler message:
org-dartlang-debug:synthetic_debug_expression:1:1: Error: Method not found: 'toStringDeep'.
toStringDeep()
^^^^^^^^^^^^
org-dartlang-debug:synthetic_debug_expression:1:1: Error: The method 'toStringDeep' isn't defined for the class 'NumberFormat'.
 - 'NumberFormat' is from 'package:intl/intl.dart' ('file:///Users/chandra/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.15.7/lib/intl.dart').
Try correcting the name to the name of an existing method, or defining a method named 'toStringDeep'.
toStringDeep()

2 个答案:

答案 0 :(得分:1)

这是known bug 3609130381,应在下一发行版中修复。唯一的解决方法是运行flutter clean。 (使用Android Studios工具-> Flutter-> Flutter Clean也应该起作用)。

答案 1 :(得分:1)

每次都这样做很麻烦,因此我将其保存为默认配置,该配置适用于任何Flutter运行。

  1. Run-> Edit Configurations
  2. 选择Flutter,然后添加新的外部工具配置,例如 add external tool
  3. 下一个创建工具,如图所示 step 3
  4. 确保已检查我们的外部工具 step 4
  5. 最后,你应该有类似的东西 step 5
  6. 好吧,做完了!

现在,每次您运行Flutter应用程序时,它将首先清理构建。