I moved on to the next step in the Flutter getting started tutorial, managing to create a new app project with a bit more functionality.
While the directions were for the most part correct and complete, they were a bit murkier in some spots than in the earlier tutorial sections. In particular:
- Before you create a new project, close the prior project by closing VS Code. If you create a new project with the old project still open then VS Code will spawn a new window with the new project, detached from the simulator. Just close VS Code and reopen it, then create the new project for this step.
- In Step 1 you’re advised to “delete all the code from lib/main.dart”. That’s wrong. Do that and you pretty much cripple the entire project. Instead delete class MyApp’s build() method in the project and copy/past the build() method code in the tutorial into its place.
- In Step 2 you learn to add and reference an external package. The writer assumes you’re using Android Studio when you update pubspec.yaml. Since I’m in VS Code, when the instructions tell you to click “Packages get” in Android, press [Shift][Command][P] (remember I’m on a Mac) to bring up VS Code’s Command Palette (the menu View | Command Palette… does the same thing) and type “Flutter: Get Packages” to perform the same exact function.
The rest of the steps were uneventful and correct. At the end I had a working app that looked exactly like the view in the tutorial running in the simulator. Hurray for me.