flutter_money_formatter 0.2.1 copy "flutter_money_formatter: ^0.2.1" to clipboard
flutter_money_formatter: ^0.2.1 copied to clipboard

outdated

Money formatter for flutter. Use this package if you need more costumization when formatting money in flutter.

flutter_money_formatter #

Money formatter for flutter

Use this package if you need more costumization when formatting money in flutter.

logo

Install #

Follow this GUIDE

Usage #

Import the library

import 'package:flutter_money_formatter/flutter_money_formatter.dart';

Getting Started #

To be able to format the double value into the various formats you want, you first need to create a FlutterMoneyFormatter instance like the following:

FlutterMoneyFormatter fmf = FlutterMoneyFormatter(value: 12345678.9012345);

After that you can request various results of the format as follows:

print(fmf.formattedNonSymbol); // 12,345,678.90
print(fmf.formattedLeftSymbol); // $12,345,678.90
print(fmf.formattedRightSymbol); // 12,345,678.90$
print(fmf.decimalOnly); // 90
print(fmf.withoutDecimal); // 12,345,678

Configuration #

To adjust the format to suit your needs, you can use my favorite notation way:

FlutterMoneyFormatter fmf = FlutterMoneyFormatter(value: 12345678.9012345)
    ..symbol = 'IDR'
    ..thousandSeparator = '.'
    ..decimalSeparator = ','
    ..decimalLength = 3
    ..spaceBetweenSymbolAndNumber = true;

Of course, you don't need to change the whole notation. By default the parameters above have the default values as follows:

Notation Data Type Default Value
symbol String $ (USD Symbol)
thousandSeparator String ,
decimalSeparator String .
decimalLength int 2
spaceBetweenSymbolAndNumber bool false

Duplicating the instance and change some configurations

FlutterMoneyFormatter fmf = FlutterMoneyFormatter(value: 12345678.9012345)

print(fmf.formattedLeftSymbol);
print(fmf.copyWith(symbol: 'IDR', spaceBetweenSymbolAndNumber: true).formattedLeftSymbol);
96
likes
0
pub points
78%
popularity

Publisher

unverified uploader

Money formatter for flutter. Use this package if you need more costumization when formatting money in flutter.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, intl

More

Packages that depend on flutter_money_formatter