Flutter Redux 启动器/代码生成器
Flutter/Redux 的入门项目和代码生成器。
视频
我们正在使用这种方法来开发 Invoice Ninja 的 Flutter 应用。
用法
步骤 1:克隆 GitHub 仓库
git clone [email protected]:hillelcoren/flutter-redux-starter.git <application> && cd <application>
步骤 2:初始化项目
./starter.sh init <公司> <应用> <网址>
步骤 3:创建模块
./starter.sh make <应用> <模块> <字段>
例如
git clone [email protected]:hillelcoren/flutter-redux-starter.git hacker_news && cd hacker_news
./starter.sh init hacker_news articles api.hackerwebapp.com
./starter.sh make articles article title,url
# Change the route on line 20 of lib/data/repositories/article_repository.dart from /articles to /news
flutter run
注意:在 macOS 上,sed 会留下以 -e 结尾的备份文件,您可以使用此命令删除这些文件
find . -name "*-e" -type f -delete
特点
- 支持大型 Redux 存储,通过单独持久化部分数据
- 应用状态(包括导航)在表单更改时持久化
- 自动实现排序和搜索支持
- 账户电子邮件也备份在共享偏好设置中
- 所有状态和模型类均使用 built_values 创建
包含的包
- flutter_redux - 消费 Redux Store 来构建 Flutter Widget
- redux_logging - 打印最新的状态/动作更改
- path_provider - 查找文件系统上常用位置
- shared_preferences - 为简单数据提供持久化存储
- build_runner - 使用 Dart 代码生成文件的具体方法
- built_value - Dart 的 Built Values
- built_collection - Dart 的 Built Collections
- memoize - 缓存函数调用的结果