Could not build the application for the simulator.

often encounter

When running the simulator, running and running again, an error is reported

Could not build the application for the simulator.

Error launching application on iPhone 14 Pro Max.

My solution is to enter in the terminal of VSCode

flutter clean

 Then just re-run

Oh, and note the comment in your .dart file // import 'dart:html';

 Sometimes modifying the main.dart code for a certain time may cause Android studio to automatically import again and  import dart:htmlfail to compile again, just need to comment or delete again 

dart:html only supports flutter_web Compilation errors on other platforms

Guess you like

Origin blog.csdn.net/zxc8890304/article/details/130425111