money2 1.0.0 copy "money2: ^1.0.0" to clipboard
money2: ^1.0.0 copied to clipboard

outdated

Simple to use Money and Currency classes. Provides Money and Currency classes with fixed precision maths operations and a nice Money formatter.

example/example.dart

import 'package:money2/money2.dart';

void main() {
  final usd = Currency.create('USD', 2);

  final aud = Currency.create('AUD', 2, symbol: '\$', pattern: 'S0.00');

  final jpy = Currency.create('JPY', 0, symbol: '¥', pattern: 'S0');

  final euro = Currency.create('EUR', 2,
      symbol: '€', invertSeparators: true, pattern: "S0,00");

  Money costPrice = Money.fromInt(10034530, usd); // 100,345.30 usd

  costPrice.format("###,###");
// > 100,345

  costPrice.format("S###,###.##");
// > $100,345.3

  costPrice.format("CC###,###.#0");
// > US100,345.30

  Money euroCostPrice = Money.fromInt(10034530, usd); // 100,345.30 EUR

  euroCostPrice.format("###.###");
// > 100.345

  euroCostPrice.format("S###.###,##");
// > €100.345,3

  euroCostPrice.format("CC###.###,#0");
// > EU100,345,30
}
172
likes
0
pub points
96%
popularity

Publisher

verified publisheronepub-web.flutter-io.cn

Simple to use Money and Currency classes. Provides Money and Currency classes with fixed precision maths operations and a nice Money formatter.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

intl

More

Packages that depend on money2