1. Gain the Flutter project

Now release is a beta version, you can use git clone – b beta at https://github.com/flutter/flutter.git

You can also switch to the Master branch and use the code from the Master branch

Add flutter to path

Open.bash_profile (typically in the current user’s Mac directory),

exportPATH=[flutter project directory]/flutter/bin:$PATH
Copy the code

eg:

Run the following command line to refresh:

source ~/.bash_profile
Copy the code

Verify that the flutter/bin directory is in PATH by running the following command:

echo $PATH
Copy the code

3. IOS environment dependence

The environment and tools for deploying the Flutter application to iOS devices need to be installed via Homebrew:

brew install --HEAD libimobiledevice
brew install ideviceinstaller ios-deploy cocoapods
Copy the code

There are many different situations in different situations. If the flutter doctor fails, locate the problem

Create a Flutter project

After the above three environments are almost done, now let’s build a Flutter project. Go to the directory where you want to save the project and execute the command:

flutter create flutterapp
Copy the code

Flutterapp is the project name and cannot be uppercase.

If you encounter any of the above problems midway, you can execute the flutter doctor to locate the problem:

5. Run the FLUTTER project

There are two ways to run projects: the command line and the XCode run

1. Command line

Connect the real machine to the computer, enter the flutter project file, and then execute the flutter run command, eg:

cd flutterapp
flutter run 
Copy the code

At this time, you will be prompted to connect the real phone information, as shown in the picture below, where * is the phone ID

Flutter run -d Mobile PHONE ID

flutter run -d 47662d3bad7fa0da458a703b262c04a69c0714cf
Copy the code
2. Run XCode

Alternatively, go directly to the ios folder in the project, open Runner. Xcworkspace, and run the project.

The interface display