From 9a1cdd7d9d3f444172cdd4c60c828daf89d9c263 Mon Sep 17 00:00:00 2001 From: Chen Peng Date: Tue, 30 Apr 2024 19:38:14 +0800 Subject: [PATCH] =?UTF-8?q?README=EF=BC=9A=E8=AE=BE=E8=AE=A1=E5=8E=9F?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++++++++++ packages/you_dart/README.md | 2 ++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index bbfc400a..de2f2223 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,13 @@ git clone git@github.com:chen56/note.git ./bake flutter_web dev # run as local macos app ./bake flutter_web dev_html # run as local web html app ``` + + +## 框架设计原则: + +- 一般性的函数/对象oo设计原则,略... +- 减少魔法代码,dart最牛逼的是依赖库的开源性,不要让人点进去时说我c,就这么个小功能搞这么复杂(比如本库内state.dart最初版本的字段自动注册机制,后改为主动调用注册函数) +- 如有可能,尽量避免代码生成 +- 尽量减少对客户代码的干扰,比如给客户程序要求继承某XXXWidget基础类这种设计,违反flutter一般性直觉 +- 无生命期的设计,避免客户代码使用addListener/removeListener、open/close这种需要自己操心打开关闭等生命周期的方法,与其和内存泄漏作斗争,不如避免硬刚 +- 减少class static 函数,类似Types.isType(),应设计为 object method + global var的形式,'types=Types; types.isType()', 给客户程序依赖注入的机会 \ No newline at end of file diff --git a/packages/you_dart/README.md b/packages/you_dart/README.md index b537576d..117220d9 100644 --- a/packages/you_dart/README.md +++ b/packages/you_dart/README.md @@ -16,3 +16,5 @@ A package that facilitates for dart applications. ## Getting started ref: https://github.com/chen56/notes/flutter_web + +