More Dart 是一个实用程序包,通过为集合操作、迭代、缓存、数学运算、模式匹配、排序和格式化提供便捷的方法来扩展 Dart 的核心功能。它通过提供直观且可链式调用的 API 来增强开发人员的生产力,适用于常见任务。该包设计轻量且易于集成,支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。对于希望简化重复编码模式并提高代码可读性的开发者来说,这是一个理想的选择。
适合场景
数据转换管道
缓存频繁访问的数据
对集合进行数学计算
字符串和格式处理
排序和筛选复杂数据
集合中的模式匹配
主要特点
扩展核心 Dart 类,提供有用的方法
可链式调用且流畅的 API 设计
支持跨平台开发
轻量且无依赖
全面的实用函数
通过 pub add 轻松集成
适合对象
寻求增强实用函数的 Dart 开发人员
需要频繁数据处理的项目
致力于减少样板代码的团队
面向多平台的应用程序
专注于代码清晰度和可维护性的开发者
使用建议
如果扩展核心类型,可能会引入细微的行为变化
由于抽象层的存在,不适合用于对性能要求极高的热路径
除了基本示例外,文档有限
最好与强类型编程实践结合使用
需要熟悉 Dart 扩展方法
原始 README
以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。
More Dart — Literally
A collection of extensively tested extensions that make Dart a better place:
This library is open source, stable and well tested. Development happens on GitHub. Feel free to report issues or create a pull-request there. General questions are best asked on StackOverflow.
The goal of the library is to provide a loose collection of carefully curated utilities that are not provided by the Dart standard library. All features must be well tested. New features must have significant advantages over alternatives, such as code reduction, readability improvement, speed increase, memory reduction, or improved accuracy. In case of doubt, consider filing a feature request before filing a pull request.
History
This library started in April 2013 as I was working through the puzzles of Project Euler and encountered some missing features in Dart. Over time the code grew and became more useful in many other places, so I created this reusable library.
Some parts of this library are inspired by similar APIs in Google Guava (Google core libraries for Java) and Apache Commons (a repository of reusable Java components).