当前位置:网站首页>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!;
}
}
边栏推荐
- 六月 致 -.-- -..- -
- Détails du contrôle de la congestion TCP | 3. Espace de conception
- Register in PHP_ Globals parameter settings
- [combinatorics] combinatorial identities (review of eight combinatorial identities | product of combinatorial identities 1 | proof | use scenario | general method for finding combinatorial numbers)
- Advanced Mathematics (Seventh Edition) Tongji University exercises 2-1 personal solutions
- 无心剑中译泰戈尔《漂鸟集(1~10)》
- EditText request focus - EditText request focus
- 【Proteus仿真】8×8LED点阵屏仿电梯数字滚动显示
- 用同花顺炒股开户安全吗?
- PHP中register_globals参数设置
猜你喜欢

Mixlab编辑团队招募队友啦~~

【Proteus仿真】8×8LED点阵屏仿电梯数字滚动显示
![[proteus simulation] 8 × 8LED dot matrix screen imitates elevator digital scrolling display](/img/46/c7f566f8fd46d383b055582d680bb7.png)
[proteus simulation] 8 × 8LED dot matrix screen imitates elevator digital scrolling display
![[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
![[list to map] collectors Tomap syntax sharing (case practice)](/img/ac/e02deb1cb237806d357a88fb812852.jpg)
[list to map] collectors Tomap syntax sharing (case practice)

The difference between calling by value and simulating calling by reference

NSQ源码安装运行过程
![[solved] access denied for user 'root' @ 'localhost' (using password: yes)](/img/71/1ff8ed1d773da99054310f96dca3f8.jpg)
[solved] access denied for user 'root' @ 'localhost' (using password: yes)

Salary 3000, monthly income 40000 by "video editing": people who can make money never rely on hard work!

Explore Netease's large-scale automated testing solutions see here see here
随机推荐
Famous blackmail software stops operation and releases decryption keys. Most hospital IOT devices have security vulnerabilities | global network security hotspot on February 14
Record a jar package conflict resolution process
"Remake Apple product UI with Android" (3) - elegant statistical chart
Salary 3000, monthly income 40000 by "video editing": people who can make money never rely on hard work!
深入理解 SQL 中的 Grouping Sets 语句
利用MySQL中的乐观锁和悲观锁实现分布式锁
相同切入点的抽取
Nifi from introduction to practice (nanny level tutorial) - flow
PHP中register_globals参数设置
记一次jar包冲突解决过程
MB10M-ASEMI整流桥MB10M
Golang 装饰器模式以及在NSQ中的使用
Function introduction of JMeter thread group
Is it safe to open a stock account by mobile registration? Does it need money to open an account
SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
Myopia: take off or match glasses? These problems must be understood clearly first
架构实战营 - 第 6 期 毕业总结
线程池执行定时任务
From the 18th line to the first line, the new story of the network security industry
Explore Cassandra's decentralized distributed architecture