Flutter installation and upgrade

1. Introduction to flutter

Flutter Widget is built using a modern responsive framework, which is inspired by React. The central idea is to use Widgets to build UIs. Widgets describe what their views should look like given their current configuration and state. When the widget's state changes, the widget will rebuild the UI, and Flutter will compare the changes before and after to determine the minimum change required for the underlying rendering tree to transition from one state to the next.

Flutter is developed using the dart language. It is best to have a basic knowledge of Dart before using it.

2. Installation

There are detailed installation steps on flutter Chinese website

  1. HomeBrew needs to be installed first
  2. Download Flutter
  3. runflutter doctor
  4. Follow the prompts to install the configuration file

3. Upgrade Flutter in the project

1. Flutter branch

stable: flutter stable branch.
master: Development branch, you can view the latest changes, low stability.

To view the currently used branch, run flutter channel
switch branch, flutter channel betaorflutter channel master

2. Develop Flutter SDK for the project

pubspec.yamlFlutter SDK dependencies can be specified in files. For example, the following code snippet specifies flutterand flutter_testpackages use the Flutter SDK.

name: hello_world
dependencies:
  flutter:
    sdk: flutter
dev_dependencies:
  flutter_test:
    sdk: flutter

Do not use the pub getor pub upgradecommand to manage your dependencies. Instead, use flutter packages getor flutter packages upgrade. If you want to use pub manually, you can FLUTTER_ROOTrun it directly by setting environment variables.

3. Upgrade Flutter channel and packages

pubspec.yamlTo update both the Flutter SDK and your dependencies, run the command in your application root directory (the directory containing the files) flutter upgrade:

 $ flutter upgrade

4. Upgrade your dependencies

If you modified pubspec.yamlthe file, or just want to update the packages your app depends on (excluding the Flutter SDK), use the following command:

  • flutter packages getGet pubspec.yamlall dependent packages listed in the file
  • flutter packages upgradeGet pubspec.yamlthe latest version of all dependent packages listed in the file

Guess you like

Origin blog.csdn.net/guoxulieying/article/details/131481763