Introduction to the

An APP project Mini template provides encapsulation of HTTP, routing, local cache and other common functions

Open source address

The mini version: github.com/un-pany/flu…

version

Flutter_template_mini version: github.com/un-pany/flu…

Flutter_template_plus version: github.com/un-pany/flu…

rendering

function

- Identity Authentication - Login - Logout - HTTP - Dio encapsulation based on third-party library - Response interception - Routing - Encapsulation Navigator 1.0 - Route interception - Status management - Provider based on third-party library - Dark Mode - Local cache - Encapsulation based on three-party library Shared_preferences - other - project pre-initialization - double return confirmationCopy the code

The directory structure

# Flutter_Template_Mini ├─ Assets # Static Resources │ ├─ ICONS # │ ├─ images # Images │ ├─ Jsons # JSON ├─ lib │ ├─ common # Global public classes, methods, variables such as │ ├ ─ db # local cache │ ├ ─ HTTP # HTTP │ │ ├ ─ API │ │ └ ─ request │ ├ ─ models # model layer │ ├ ─ the navigator # the navigator # 1.0 │ ├ ─ pages all pages │ ├ ─ the provider # state management │ ├ ─ utils # tools ├ ─ └ ─. Main dart # entrance └ ─ pubspec. Yaml # package managementCopy the code

The development of

# install dependenciesFlutter packages get or flutter pub get# Analyze code
flutter analyze

# Run the project
flutter run

If you encounter a Shader compilation error, you can run clean and then run
flutter clean

# Android real machine debugging
flutter devices
flutter run

# Android pack
flutter build apk
Copy the code

The development environment

  1. Flutter version 2.8.0
  2. The Dart version 2.15.0
  3. The Android SDK version 31.0.0

The development tools

  1. Editor Visual Studio Code
  2. Plug-in Dart
  3. The plugin Flutter
  4. Plugin for Flutter Widget Snippets

Git submission specification

  • featAdd new features
  • fixFix problems/bugs
  • styleCode style dependence does not affect the results of the run
  • perfOptimization/performance improvement
  • refactorrefactoring
  • revertUndo modify
  • testRelevant test
  • docsDocumentation/comments
  • choreDependency updates/scaffold configuration modifications, etc
  • workflowWorkflow improvement
  • ciContinuous integration
  • typesType definition file changes
  • wipThe development of
  • modModification of indeterminate classification

❓ about JSON to Dart Model class

  1. Pure handwriting entities (not recommended)
  2. Use web page autogeneration tool: Automatically generate entity classes from JSON and copy them to the project (common to all projects)
  3. Use the plug-in JSON_serializable (more suitable for large projects)

The scaffolding adopts the second scheme

Here is a random autogenerated url: json_to_dart

JSON < — > Map < — > Dart Model is a common technique

❓ About Routing

  1. Official Navigator 1.0
  2. – Official Navigator 2.0 (Flutter 1.22)
  3. Tripartite plugin fluro

The scaffold adopts the first scheme and encapsulates it

The Navigator 2.0 concept is somewhat difficult

❓ About Flutter_TEMPLate_plus and flutter_TEMPLate_mini

  1. The Mini version uses Navigator 1.0, which has straightforward logic, while the Plus version uses the more powerful but difficult to understand Navigator 2.0
  2. Mini version of the HTTP layer is directly based on Dio encapsulation, the code structure is clear and simple, while the Plus version of the side library MyNet, through the adapter integration Dio, more flexible, pluggable
  3. The MINI DB layer is directly encapsulated based on shared_Preferences, while the Plus version is based on shared_Preferences to write the MyCache library
  4. The Mini is packaged in a way that is closer to modern front-end engineering, while the Plus is more object-oriented

📚 Introduction to Flutter series of articles

  1. Flutter goes from 0 to 1
  2. Mobile learning tips