The method of writing and using flutter applications with vscode is:
1. Configure the plug-in
You need to download the plug-in in vscode
Just find these two plug-ins, download them and reload vscode. .
2. Run
The running command of the flutter project is flutter run
But the difference between flutter and react-native is that after flutter run, it will detect whether the device is connected. , if there is no connected device, it will not run.
You can use flutter devices. Of course, if you configure the android environment, you can also use the dab command and adb devices.
After the project is running, there will be some output information in the terminal below, including compilation time, debugging package, installation, etc.
There are also some prompt messages
Press r when you need to hot load, and press R when you need to restart the application.
So every time we write the code and save it, just press r again to see the latest effect, and flutter's hot loading is faster than rn's.
3. Write the first flutter application.
Follow the flutter Chinese website (https://flutterchina.club/get-started/codelab/)
Write our first flutter application.
I personally encountered a problem.
In step 2, using external packages,
declares the plug-in dependency in the pubspec.yaml file, automatically downloads it after saving, and then in main. The plug-in was referenced in the dart file, and I found that there was no automatic completion prompt. I wrote all the paths by hand, but the prompt was not found.
Then reopen vscode. It should be a problem with vscode reading this.
Then continue to write according to the Chinese code. Flutter also has state, which is said to be added based on the idea of state in react.
Personal experience
The flutter project is smoother than rn, compiles faster, hot loads faster, and the application runs more smoothly, but the dart syntax is really painful
fluuter Chinese website writing The documentation does not feel very user-friendly, and many key things are not specific enough or even not written.
There is no explanation of state, no instructions for using state, and the same goes for routing.
Recommended tutorial: "vscode Getting Started Tutorial"
The above is the detailed content of How to write and use flutter applications with vscode. For more information, please follow other related articles on the PHP Chinese website!