flutter_money_formatter 0.5.4

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new76

FlutterMoneyFormatter #

FlutterMoneyFormatter is a Flutter extension to formatting various types of currencies according to the characteristics you like, without having to be tied to any localization.

latest version last commit License

Dependencies : #

intl


Install #

For complete steps in installing FlutterMoneyFormatter you can see in the Installation Guide.

Usage #

Import the library

import 'package:flutter_money_formatter/flutter_money_formatter.dart';

Getting Started #

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

FlutterMoneyFormatter fmf = FlutterMoneyFormatter(amount: 12345678.9012345);

Note, the code above still uses the default configuration as explained here.

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

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

// compact form
print(fmf.compactNonSymbol) // 12.3M
print(fmf.compactLeftSymbol) // $12.3M
print(fmf.compactRightSymbol) // 12.3M$

See demo section to get more info.

Configurations #

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

FlutterMoneyFormatter fmf = new FlutterMoneyFormatter(amount: 12345678.9012345)
    ..symbol = 'IDR'
    ..thousandSeparator = '.'
    ..decimalSeparator = ','
    ..fractionDigits = 3
    ..symbolAndNumberSeparator = '-';

Of course, you don't need to change the whole properties like on above sample. By default the properties have the default values as follows:

Configuration PropertyData TypeDefault ValueDescription
symbolString$ (Dollar Sign)The symbol that will be used on formatted output.
thousandSeparatorString,The character that will be used as thousand separator on formatted output.
decimalSeparatorString.The character that will be used as decimal separator on formatted output.
fractionDigitsint2The fraction digits that will be used on formatted output.
symbolAndNumberSeparatorString' ' (Space)If the value is [true] then formatted output will shown space between the number and the currency symbol.
compactFormatTypeCompactFormatTypeCompactFormatType.sortCompact format type, sort or long type.

CompactFormatType #

You can change the type of compact format like for million using M or million, or trillion using T or trillion. and so on. This type only supports two type as described below:

ValueDescription
CompactFormatType.sortUsed to make the compact format displayed using sort text.
CompactFormatType.longUsed to make the compact format displayed using long text.

Duplicating Instance #

For some reasons, you may need to duplicate the instance and just need to change some configurations. To do that, you can use the copyWith method as below:

FlutterMoneyFormatter fmf = FlutterMoneyFormatter(amount: 12345678.9012345)

print(fmf.formattedLeftSymbol); // $ 12,345,678.90
print(fmf.copyWith(symbol: 'IDR', symbolAndNumberSeparator: '-').formattedLeftSymbol); // IDR-12,345,678.90

Complete Methods #

MethodParameterDescriptions
isLowerThanamountCheck current instance-amount is lower than [amount] or not.
isGreaterThanamountCheck current instance-amount is greater than [amount] or not.
isEqualamountCheck current instance amount is equal than [amount] or not.
isEqualOrLowerThanamountCheck current instance amount is equal or lower than [amount] or not.
isEqualOrGreaterThanamountCheck current instance amount is equal or greater than [amount] or not.
CopyWithsee heresee here

Demo #

For more complete samples, you can grab it from the example directory.

Help Me #

If you find an issue, bug, question, or want to request a new feature you can do it here. You can also help me to improve features or fix some issues by forking this project via Github

ChangeLog #

Are you curious about the changes that occur in each version? See here for detailed informations.

Version 0.5.* #

  • [0.5.4]

    • [DEPRECATED] spaceBetweenSymbolAndNumber is deprecated and UPDATEd with symbolAndNumberSeparator
    • [ADD] symbolAndNumberSeparator with String data type.
    • [UPDATE] documentation to match with the library capability.
    • [UPDATE] Formatting source code as suggested by pub.dartlang.org.
  • [0.5.3]

    • [FIX] UPDATELOG format
  • [0.5.2]

    • [FIX] Fix missing tags on documentation
    • [ADD] License notice on library
    • [ADD] library tag on header
  • [0.5.1]

    • [UPDATE] Update documentation
  • [0.5.0]

    • [FIX] Compact form as described here
    • [DEPRECATED] CompactFormatCase.
    • [UPDATE] Update documentation.
    • [ADD] CompactFormatType enum on format settings

Version 0.4.* #

  • [0.4.8+1]

  • [0.4.8]

  • [0.4.7]

    • [UPDATE] Package description
    • [UPDATE] Enhance documentation
  • [0.4.6]

    • [FIX] Inconsisten naming on source code & documentation
  • [0.4.5]

    • [FIX] Documentation for method name changes.
  • [0.4.2]

    • [UPDATE] Revise license note.
  • [0.4.1]

    • [ADD] Compact format support
    • [ADD] Version badges on documentation
  • [0.4.0]

    • [ADD] Compact format support.
    • [UPDATE] Update documentation.

Version 0.3.* #

  • [0.3.1]

    • [ADD] Some badges on documentation
  • [0.3.0]

    • [UPDATE] Documentation
    • [ADD] Compare methods:
      • isLowerThan
      • isGreaterThan
      • isEqual
      • isEqualOrLowerThan
      • isEqualOrGreaterThan

Version 0.2.* #

  • [0.2.2]

    • [ADD] Document public APIs
  • [0.2.1]

    • [FIX] Someline on documention files.
  • [0.2.0]

    • [OPTIMIZE] UPDATE meta package into foundation package.

Version 0.1.* #

  • [0.1.1]

    • [ADD] Documentation
    • [OPTIMIZE] Removing unecessary line
  • [0.1.0]

    • Initial Release

example/README.md

FlutterMoneyFormatter #

FlutterMoneyFormatter is a Flutter extension to formatting various types of currencies according to the characteristics you like, without having to be tied to any localization.

latest version last commit License

Dependencies : #

intl


Install #

For complete steps in installing FlutterMoneyFormatter you can see in the Installation Guide.

Usage #

Import the library

import 'package:flutter_money_formatter/flutter_money_formatter.dart';

Getting Started #

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

FlutterMoneyFormatter fmf = FlutterMoneyFormatter(amount: 12345678.9012345);

Note, the code above still uses the default configuration as explained here.

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

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

// compact form
print(fmf.compactNonSymbol) // 12.3M
print(fmf.compactLeftSymbol) // $12.3M
print(fmf.compactRightSymbol) // 12.3M$

See demo section to get more info.

Configurations #

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

FlutterMoneyFormatter fmf = new FlutterMoneyFormatter(amount: 12345678.9012345)
    ..symbol = 'IDR'
    ..thousandSeparator = '.'
    ..decimalSeparator = ','
    ..fractionDigits = 3
    ..symbolAndNumberSeparator = '-';

Of course, you don't need to change the whole properties like on above sample. By default the properties have the default values as follows:

Configuration PropertyData TypeDefault ValueDescription
symbolString$ (Dollar Sign)The symbol that will be used on formatted output.
thousandSeparatorString,The character that will be used as thousand separator on formatted output.
decimalSeparatorString.The character that will be used as decimal separator on formatted output.
fractionDigitsint2The fraction digits that will be used on formatted output.
symbolAndNumberSeparatorString' ' (Space)If the value is [true] then formatted output will shown space between the number and the currency symbol.
compactFormatTypeCompactFormatTypeCompactFormatType.sortCompact format type, sort or long type.

CompactFormatType #

You can change the type of compact format like for million using M or million, or trillion using T or trillion. and so on. This type only supports two type as described below:

ValueDescription
CompactFormatType.sortUsed to make the compact format displayed using sort text.
CompactFormatType.longUsed to make the compact format displayed using long text.

Duplicating Instance #

For some reasons, you may need to duplicate the instance and just need to change some configurations. To do that, you can use the copyWith method as below:

FlutterMoneyFormatter fmf = FlutterMoneyFormatter(amount: 12345678.9012345)

print(fmf.formattedLeftSymbol); // $ 12,345,678.90
print(fmf.copyWith(symbol: 'IDR', symbolAndNumberSeparator: '-').formattedLeftSymbol); // IDR-12,345,678.90

Complete Methods #

MethodParameterDescriptions
isLowerThanamountCheck current instance-amount is lower than [amount] or not.
isGreaterThanamountCheck current instance-amount is greater than [amount] or not.
isEqualamountCheck current instance amount is equal than [amount] or not.
isEqualOrLowerThanamountCheck current instance amount is equal or lower than [amount] or not.
isEqualOrGreaterThanamountCheck current instance amount is equal or greater than [amount] or not.
CopyWithsee heresee here

Demo #

For more complete samples, you can grab it from the example directory.

Help Me #

If you find an issue, bug, question, or want to request a new feature you can do it here. You can also help me to improve features or fix some issues by forking this project via Github

ChangeLog #

Are you curious about the changes that occur in each version? See here for detailed informations.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_money_formatter: ^0.5.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_money_formatter/flutter_money_formatter.dart';
  
Version Uploaded Documentation Archive
0.5.4 Feb 18, 2019 Go to the documentation of flutter_money_formatter 0.5.4 Download flutter_money_formatter 0.5.4 archive
0.5.3 Feb 18, 2019 Go to the documentation of flutter_money_formatter 0.5.3 Download flutter_money_formatter 0.5.3 archive
0.5.2 Feb 18, 2019 Go to the documentation of flutter_money_formatter 0.5.2 Download flutter_money_formatter 0.5.2 archive
0.5.1 Feb 15, 2019 Go to the documentation of flutter_money_formatter 0.5.1 Download flutter_money_formatter 0.5.1 archive
0.5.0 Feb 15, 2019 Go to the documentation of flutter_money_formatter 0.5.0 Download flutter_money_formatter 0.5.0 archive
0.4.8+1 Feb 15, 2019 Go to the documentation of flutter_money_formatter 0.4.8+1 Download flutter_money_formatter 0.4.8+1 archive
0.4.8 Feb 15, 2019 Go to the documentation of flutter_money_formatter 0.4.8 Download flutter_money_formatter 0.4.8 archive
0.4.7 Feb 15, 2019 Go to the documentation of flutter_money_formatter 0.4.7 Download flutter_money_formatter 0.4.7 archive
0.4.6 Feb 13, 2019 Go to the documentation of flutter_money_formatter 0.4.6 Download flutter_money_formatter 0.4.6 archive
0.4.5 Feb 12, 2019 Go to the documentation of flutter_money_formatter 0.4.5 Download flutter_money_formatter 0.4.5 archive

All 22 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
51
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

We analyzed this package on Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13+1
  • Flutter: 1.2.1

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
intl ^0.15.7 0.15.7
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
path 1.6.2
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8