Initial commit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
谢宇宁
2026-11-05 10:38:11 +07:00
co-authored by Claude Opus 5.5
commit 2d26ea8f90
1071 changed files with 100151 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
/// 可空 num 扩展
extension NumNullableX on num? {
/// 防止字段为空报错
num em() => this ?? 0;
/// 数字转金额保留两位小数
String toAmount() => em().toStringAsFixed(2);
}
/// 非空 num 扩展
extension NumX on num {
/// 小数点截取 [fractionDigits] 位(直接截断,不四舍五入)
String fixed(int fractionDigits) {
final fixString = toStringAsFixed(fractionDigits + 1);
return fixString.substring(0, fixString.length - 1);
}
}