Flutter has been around for a long time, and it is also cross-platform. It is promoted by Google and has the same functions as Weex reactive Native. We won’t talk about the advantages and disadvantages of Flutter, but there are a lot of articles available online. Today we will focus on analyzing how the Flutter project differs from our traditional Android project and how these differences work.

Before we explain flutter, we hope you have some basic knowledge of Flutter and Gradle, because we are going to analyze the most complex and complete differences between Flutter and the native hybrid engineering and the traditional Android engineering. While explaining the differences, we will also explain the important functions of several Gradle files. So it’s good to have a basic understanding of these things so that they don’t look too taxing.

Since we are going to talk about flutter engineering, we will first create a flutter engineering (hybrid engineering, non-pure Flutter engineering) as shown below:

As shown in the picture above, let’s analyze each of them. Take a look at the differences between a Flutter hybrid project and our traditional Android project.

There is no difference between the gradle file, which contains the gradle version of our current project. Next is our Android folder, which contains our Android project. Next is our Asset folder, which contains the resources of the Flutter project, including images. Font, video, and any other resource files, http_plugin, we will not look at it, because it is a plug-in project, we will look at the last, next to the ios folder, of course, where we store all the content of the ios project, next to the lib folder, The last and most important file is pubspec.yaml. This file is used to configure the dependencies required by the FLUTTER project, etc. Here we can see what is special about the flutter project as a whole. Of course, it is still only a whole, but let’s compare it with a picture, and take a look at the overall differences with traditional Android projects.

The last part of the Flutter project is the stuff of the Flutter project itself, including its resources and code, as well as dependencies, etc. So don’t be afraid of Flutter because it’s just a little bit more complicated.

Let’s start with the simplest possible FLUTTER project. There are three main folders. The first folder, lib, contains part of the FLUTTER code, namely a series of DART files, as shown in the figure below:

So if you want to learn to write flutter, you need to have some drAT foundation. The second part is the asset folder. Take a look at what I put in the project, as shown below:

In this project, I mainly store font resources and the diagrams used by each module. The final configuration file of Flutter is pubspec.yaml. This file contains the following contents:

Description: A new Flutter module. Version: 1.0.0+1 environment: SDK: ">=2.0.0-dev.68.0 <3.0.0" flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS Style ICONS. Cupertino_icons: ^0.1.2 device_info: 0.2.1intl: 0.15.7 Connectivity: 0.3.2 english_words: ^3.1.0 url_launcher: 4.0.1 video_player: 0.7.2 dev_dependencies: flutter_test: SDK: Http_plugin: path:./http_plugin/ json_serializable: ^2.0.0 build_runner: ^1.0.0 # For information on the generic Dart part of this file, see the # following page: https://www.dartlang.org/tools/pub/pubspec # in the third section, the flutter of resources that flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true assets: - asset/images/ fonts: - family: Raleway fonts: - asset: asset/fonts/raleway/Raleway-Regular.ttf - asset: asset/fonts/raleway/Raleway-Medium.ttf weight: 500 - asset: asset/fonts/raleway/Raleway-SemiBold.ttf weight: 600 module: androidPackage: com.imooc.fluttermodule iosBundleIdentifier: com.imooc.flutterModuleCopy the code

As you can see, it is also very simple, mainly used to manage the code, dependencies, and resources of the FLUTTER project itself.

Now that we know about the specific structure of the Flutter project, let’s take a look at some of the complexities. How do the Dart code and resources of the Flutter project get into our final executable, APK? Now we will see how the Flutter project can be combined with the Android project shown here. Because this section is quite long, we will cover it in the next article. Since the | the original address

Welcome to:

Download and install Flutter Mac/Flutter Windows

Flutter development practice: high imitation wechat (a) home page

Flutter development practice: high imitation wechat (ii) discovery page

Thank you for viewing the information:

Data download