What is a Flutter?
Flutter is a mobile app SDK, a single piece of code that generates high performance, high fidelity applications for both iOS and Android.
Why use Flutter?
What are the advantages of Flutter? It can help you:
- Improve development efficiency
- Same code for iOS and Android
- Do more with less code
- Easy iteration – changing code while the application is running and reloading it (via hot reload) – fixing crashes and continuing debugging from where the application left off
- Create a beautiful, highly customized user experience
- Benefit from the rich Material Design and Cupertino (ios-style) widgets provided using the Flutter framework
- Achieving a custom, beautiful, brand-driven design without the limitations of native controls, Flutter aims to enable developers to deliver high-performance applications that feel natural and fluid across different platforms. We accept differences in scrolling behavior, typography, ICONS, etc.
Without further ado, this article is about how to start the journey of flutter from 0 to 1. (This tutorial is done on a Mac.)
Due to restrictions on access to Flutter in China, Flutter officials have set up temporary images for Chinese developers, so we need to add environment variables on this machine
- View local environment variables
cat .bash_profile
Copy the code
- Edit local environment variables
vi .bash_profile
Copy the code
- Add the following two items to.bash_profile
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
Copy the code
- Application. The following
source .bash_profile
Copy the code
Access to Flutter the SDK
You can download it from the official website (science Online) or from github (github.com/flutter/flu) as I did. After downloading Flutter to determine the directory of your Flutter SDK, open.bash_profile and add the following line
export PATH=your_flutter_location/flutter/bin:$PATH
Copy the code
Don’t forget source.bash_profile after you add it
Run the flutter doctor
Dart SDK is already bundled into Flutter, there is no need to install Dart separately. Run the following command to see if additional dependencies need to be installed to complete the installation:
flutter doctor
Copy the code
If the Android SDK is not installed or the version is too low or ANDROID_HOME is not added, install it by yourself. Attached is my own.bash_profile for your reference
exportJAVA_HOME = $(/ usr/libexec/JAVA_HOME - v1.8)export SCALA_HOME=/usr/local/share/scala
export PATH=$PATH:$SCALA_HOME/bin
export PATH=/usr/local/ Cellar/python / 2.7.13 / bin:$PATH
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/xyli/IdeaProjects/flutter/flutter/bin:$PATH
export ANDROID_HOME=/Users/xyli/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
Copy the code
IO Android License Status Unknown. The reason for this problem is that my JDK version is too high. There is no problem running flutter Doctor after switching to JDk1.8. Then run Flutter Doctor — Android-Licenses all the way down. Finally run the flutter doctor all green to indicate that your flutter has been configured and you can happily start hello world.
Attached flutter demo written by the official website: github.com/lixueying/f…
Flutterchina. club/get-started…