Flutter learning (1) environment construction and development tool configuration

With the increasing use of APP, rapid development of APP becomes more and more important. At present, the mainstream flutter, uni-app, ReactNative in the market. . . Wait,
this series of topics mainly study flutter. Before learning flutter, you need to learn Dart first to lay the foundation for later learning flutter.

1. Why use Dart?

Google and other developers around the world have used Dart to develop a series of high-quality, critical iOS, Android and web applications. Dart is very suitable for mobile and web application development.

Dart is free and open source on  GitHub.

Efficient

Dart has clear and concise syntax, simple and powerful tools. Input detection can help you identify subtle errors as early as possible. Dart has a proven  core library  and an ecosystem of thousands of packages 

fast

Dart provides ahead-of-time compilation optimization to achieve predictable high performance and fast startup on mobile devices and the web.

Portable

Dart can be compiled into ARM and x86 code, so Dart mobile applications can be run locally on iOS, Android and higher. For web applications, Dart can be converted to JavaScript.

Easy to learn

Dart is an object-oriented programming language, and its syntax style is familiar to many existing developers. If you already know C++, C# or Java, then using Dart is a matter of minutes.

Responsive

Dart can easily perform reactive programming. Due to the implementation of fast object allocation and garbage collector , Dart is more efficient for managing short-term objects (such as UI widgets). Dart can implement asynchronous programming through  the features and APIs of Future  and  Stream  .

2. Dart environment construction

2.1 Tool download

  1. AndroidStudio tool download: https://developer.android.google.cn/studio/
  2. git tool download: https://git-scm.com/downloads
    If git downloads slowly on the official website: https://npm.taobao.org/mirrors/git-for-windows/

2.2 Environment configuration

  • mac:
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
  • Windows:

2.3 Download flutter source code

2.3.1 Create a directory to store source code

Official source code: git clone https://github.com/flutter/flutter.git -b stable
If pulling the code on github is very slow, you can pull the
git clone mapped on the code cloud https://gitee.com/mirrors/ Flutter.git -b stable

2.3.2 Configure system environment

Add flutter's bin directory to the path

2.3.3 Win7 can not use flutter problem

https://www.microsoft.com/en-us/download/confirmation.aspx?id=54616

If you encounter powershell cannot be installed, it will display: Windows Management Framework

https://www.microsoft.com/en-us/download/details.aspx?id=54616

2.4 Use flutter doctor command

Open the cmd window and execute the flutter doctor command to wait for the installation to complete

  

2.5 Modify download source

My personal installation path: D:\flutter-workspace\Flutter\packages\flutter_tools\gradle\flutter.gradle

Modify content

maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
maven { url 'http://download.flutter.io' }


private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn/download.flutter.io";

3. Start AndroidStudio

3.1 Download flutter plugin
3.2 Download dart plugin

    

If you can’t download it,
download the flutter plugin offline : https://plugins.jetbrains.com/plugin/9212-flutter/versions/stable
Download the dart plugin offline: https://plugins.jetbrains.com/plugin/6351-dart/versions /

4. Create the first flutter project

  

4.1 Use pub get to get dependencies

4.2 Writing helloworld

Right-click to create a dart file, write the following code, and then right-click to run the code, you can see that the console is printed successfully

  

 

Guess you like

Origin blog.csdn.net/itjavaee/article/details/109125823