Flutter traps: ancestral helloworld and flutterhelloworld
Google has proposed Flutter for a long time. Since it was converted to a Java backend some time ago, it has never been time to understand it. These days are also a wave of free and easy attention.
Build a Flutter Environment
Go to the official website to check the specific environment configuration. My computer version is macOS10.13.3. Follow the steps on the official website.
git clone -b dev https://github.com/flutter/flutter.git
cd ~/.base_profileexport PATH="$PWD/flutter/bin:$PATH"
source ~/.bash_profile
That is, the flutter code git is used to set a global variable, which is smooth. Next
cd ./flutterflutter doctor
It is a little tragic. A curl downloads the flutter configuration item Timeout from google, which is the pace of scientific Internet access. Note:
export PUB_HOSTED_URL=https://pub.flutter-io.cnexport FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
In this way, the flutter server can also be configured. (For more information, see the simple flutter doctor Analysis in the next chapter)
Android Studio
Android Studio requires a version later than 3.0. download and install the flutter plug-in. The dark plug-in is automatically downloaded. Note the following points when configuring:
1. Yes
dependencies { classpath 'com.android.tools.build:gradle:3.0.1' }
Here is the use of 3.0.1, gradle version of The gradle-4.1-all, to explain the gradle local configuration method:
InGradle-> wrapper-> gradle-wrapper.propertiesFileReplace distributionUrl with your local path.
2. Scientific Internet access is required
allprojects { repositories { google() jcenter() }}
With google (), Google puts all the configurations above gradle3.0 in its maven repository. The simplest and most effective method is scientific Internet access.
I am using SS and set the global proxy. I don't know why it is MAC or why. android studio and terminal (my build prefers to use command line) cannot access the Internet scientifically. You have to reset it again:
export ALL_PROXY=socks5://127.0.0.1:1080
In Android Studio, set Proxy in perferences-> Http Proxy
3. Set the Flutter plug-in to search for the Flutter SDK in perferences and configure it as the download path.
HelloWorld
The preparations in the early stage are similar. We can find that the New Flutter project can be used in android studio, And the creation is similar to that of android applications. next finish. This configuration can be configured properly.
Such a structural hierarchy can define our interface in main. dart.
Not end