dencend_utils

一个实用的Flutter工具包,包含常用的扩展方法、工具类和辅助函数,简化日常开发工作。

特性

  • 字符串扩展方法
  • 日期时间扩展方法
  • 数值扩展方法
  • 集合扩展方法
  • 常用工具类
  • 格式化工具
  • 验证工具

安装

在你的 pubspec.yaml 文件中添加以下依赖:

dependencies:
  dencend_utils: ^0.0.1

然后运行:

flutter pub get

使用方法

import 'package:dencend_utils/dencend_utils.dart';

// 字符串扩展
String text = "Hello World";
print(text.capitalize()); // "Hello world"
print(text.isEmail()); // false

// 日期时间扩展
DateTime now = DateTime.now();
print(now.format('yyyy-MM-dd')); // "2023-12-07"
print.now.isToday; // true

// 数值扩展
double price = 123.456;
print(price.formatCurrency('¥')); // "¥123.46"

// 验证工具
if (DencendValidators.isEmail('user@example.com')) {
  print('有效的邮箱地址');
}

// 格式化工具
String formattedSize = DencendFormatters.fileSize(1024 * 1024); // "1 MB"

示例

更多示例请参见 example 文件夹。

问题反馈

如果您在使用过程中遇到任何问题,请通过以下方式联系我们:

许可证

MIT License - 详见 LICENSE 文件。