MoneyUtils class

  • @Author: chuxiong
  • @Created at: 23-07-2025 17:29
  • @Email:
  • description 金额格式化与分/元互转工具:changeF2Y* 系输入以**分(fen)为单位, changeY2F 输入以元(yuan)**十进制字符串为单位。 依赖:decimal(纯 Dart,大额精度经其保证)。

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

changeF2Y(int amount, {MoneyFormat format = MoneyFormat.NORMAL}) → String
fen to yuan, format output. 分 转 元, format格式输出.
changeF2YWithUnit(int amount, {MoneyFormat format = MoneyFormat.NORMAL, MoneyUnit unit = MoneyUnit.NORMAL}) → String
fen to yuan, format & unit output. 分 转 元, format 与 unit 格式 输出.
changeFStr2YWithUnit(String amountStr, {MoneyFormat format = MoneyFormat.NORMAL, MoneyUnit unit = MoneyUnit.NORMAL}) → String
fen str to yuan, format & unit output. 分字符串 转 元, format 与 unit 格式 输出.
changeY2F(String yuan) → int
yuan str to fen. 元字符串 转 分.
withUnit(String moneyTxt, MoneyUnit unit) → String
with unit. 拼接单位.

Constants

DOLLAR → const String
美元符号。
YUAN → const String
人民币符号。
YUAN_ZH → const String
中文「元」。