Small knowledge, big challenge! This paper is participating in theEssentials for programmers”Creative activities

Create a project

  1. Select specify a pathflutter create flutter_demo.flutterHump naming is not supported_Can be separated
  2. Once you’ve created it, if you look at the file structure, you can see that there areios andandroidAs you can seeiosThe default is adoptedswiftLanguage. If you are comfortable with the OC syntax, add a configuration when you create your project

  1. Modify the default language for authoring. Use help commandsflutter create --helpYou can see the default--ios-language wift (default) --android-language kotlin (default)

  1. Specify the languageflutter create -i objc flutter_demoCan be

Run the project

  1. You can directly open Xcode on ios and run it on both the real machine and the emulator (with a certificate configured on the real machine). Since Xcode does not support Flutter, we recommend Android Studio for short AS

  2. Flutter Run can also be used to run projects. The first time you compile the real machine you may encounter certificate problems. The solution is to compile in Xcode the first time and use command or AS the second time

  1. It is recommended that you use AS to run your project. First check to see if the plugin for Flutter is installed on AS. In Plugins, search for Flutter and then install. Restart the AS after the installation is complete

  1. If we open up the project that we created above, we can see that the structure here is ios and Android so where do we write the code? Under the libmain.dartThe top one shows that the first drop-down box is the device on which the target is running, and the second drop-down box defaults to the entry of the programmain.dartDepending on the actual situation, it is similar to target on iOS, followed by the green onerunClick here to follow upflutter runIt’s the same effect.

  1. Ok, that’s it let’s get the sample program running. You can see here that one of the obvious differences between AS and Xcode is that it can be directlyhot restartInstead of repeating run over and over again, this is the incremental mechanism inside flutter that only loads incremental files. This mechanic was great for my experience as a small developer who had been working with Xcode

  1. In the process of running the real machine, I encountered a failure to openiproxyUnable to validate developer’s prompt. The solution is to execute the following command, where/Users/xxx/Is the path of the flutter installed.
sudo xattr -d com.apple.quarantine /Users/xxx/bin/cache/artifacts/usbmuxd/iproxy
Copy the code

Now, Flutter development begins in earnest.