当前位置:网站首页>Learn from me about the enterprise flutter project: simplified framework demo reference
Learn from me about the enterprise flutter project: simplified framework demo reference
2022-07-03 16:25:00 【Erdan and his big flower】
Preface
Recently, many people are asking me , None of them is good demo, How to do single engineering mode , How to encapsulate network requests , How to do network persistence . So today I will demo Share it out . At this stage, I can't build flutter The rapid development framework is open source . Temporarily simplify demo To show .
Related articles :
Learn from me about enterprise flutter project :flutter modularization , Conception and practice of single project architecture mode
demo Address :
https://github.com/smartbackme/myflutter
For everyone to use more clearly , I will explain the directory structure :
Directory structure

Explain with a module

Module 1 startup configuration :
class MyConfiger extends ICommentConfiger{
@override
Widget getRouter(RouteSettings settings) {
var router = RouterPage.getRouter(settings);
if(router!=null){
return router;
}
return const NullRouter();
}
}
void main() {
Application.init(AppInit(MyConfiger()));
runApp(const MyApp());
}
Common module description

Main project startup instructions
import 'package:commonmodule/commonmodule.dart';
import 'package:commonmodule/config.dart';
import 'package:flutter/material.dart';
import 'package:commonmodule/router_name.dart' as common;
import 'package:kg_density/kg_density.dart';
import 'package:myflutter/page/home.dart';
import 'package:onemodule/router_page.dart' as onemodule;
import 'package:twomodule/router_page.dart' as twomodule;
// Routing assignment management
class MyCommentConfiger extends ICommentConfiger{
@override
Widget getRouter(RouteSettings settings) {
if(settings.name == common.RouterName.home){
return const HomePage();
}
var teachertRouter = onemodule.RouterPage.getRouter(settings);
if(teachertRouter!=null){
return teachertRouter;
}
var clientRouter = twomodule.RouterPage.getRouter(settings);
if(clientRouter!=null){
return clientRouter;
}
return const NullRouter();
}
}
// Start initialization
void main() async {
MyFlutterBinding.ensureInitialized();
KgDensity.initKgDensity(designWidth : 375);
await SpSotre.instance.init();
ULogManager.init();
Application.init(AppInit(MyCommentConfiger()));
runApp(const MyApp());
}
//WidgetsFlutterBinding To configure
class MyFlutterBinding extends WidgetsFlutterBinding with KgFlutterBinding {
static WidgetsBinding ensureInitialized() {
if (WidgetsBinding.instance == null) MyFlutterBinding();
return WidgetsBinding.instance!;
}
}
边栏推荐
- 手机注册股票开户安全吗 开户需要钱吗
- PHP二级域名session共享方案
- PHP CI(CodeIgniter)log级别设置
- 线程池执行定时任务
- QT串口ui设计和解决显示中文乱码
- Why can't strings be directly compared with equals; Why can't some integers be directly compared with the equal sign
- Nifi from introduction to practice (nanny level tutorial) - flow
- 拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
- How to thicken the brush in the graphical interface
- NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
猜你喜欢

Basis of target detection (IOU)

ASEMI整流桥UMB10F参数,UMB10F规格,UMB10F封装

Record windows10 installation tensorflow-gpu2.4.0

8 cool visual charts to quickly write the visual analysis report that the boss likes to see

记一次jar包冲突解决过程

Mb10m-asemi rectifier bridge mb10m

Remote file contains actual operation
![[combinatorics] non descending path problem (outline of non descending path problem | basic model of non descending path problem | non descending path problem expansion model 1 non origin starting poi](/img/81/59ed6bebf5d85e9eb71bd4ca261309.jpg)
[combinatorics] non descending path problem (outline of non descending path problem | basic model of non descending path problem | non descending path problem expansion model 1 non origin starting poi

TCP拥塞控制详解 | 3. 设计空间

【Proteus仿真】74HC595+74LS154驱动显示16X16点阵
随机推荐
"Remake Apple product UI with Android" (2) -- silky Appstore card transition animation
pyinstaller不是内部或外部命令,也不是可运行的程序 或批处理文件
LeetCode1491. Average value of wages after removing the minimum wage and the maximum wage
Visual SLAM algorithms: a survey from 2010 to 2016
Record windows10 installation tensorflow-gpu2.4.0
Nine ways to define methods in scala- Nine ways to define a method in Scala?
How to use AAB to APK and APK to AAB of Google play apps on the shelves
Expression of request header in different countries and languages
Basis of target detection (IOU)
Effect of ARP package on FTP dump under vxworks-6.6 system
Low level version of drawing interface (explain each step in detail)
Client does not support authentication protocol requested by server; consider upgrading MySQL client
Extraction of the same pointcut
Explore Cassandra's decentralized distributed architecture
手机注册股票开户安全吗 开户需要钱吗
[combinatorics] non descending path problem (outline of non descending path problem | basic model of non descending path problem | non descending path problem expansion model 1 non origin starting poi
Record a jar package conflict resolution process
【Proteus仿真】8×8LED点阵屏仿电梯数字滚动显示
近视:摘镜or配镜?这些问题必须先了解清楚
pycharm错Error updating package list: connect timed out