money2
Money2 is a high-precision library for storing, parsing, formatting, and performing arithmetic on monetary values and currencies. Fixed-decimal math, multi-currency support and conversions, parsing and formatting. (Money.parse('$2010.00') * 10).format('SCC#,##0') -> $US20,100
6.3.0
135K downloads/mo
#1003 most downloaded on pub.dev
onepub-dev/money.dart
What this package is like to depend on
Last release 6 months ago
27 Jan 2026
Release timing varies
gaps range from 8 days to 4 months
Most releases are documented
notes for 45 of 66 stable releases
2 versions withdrawn
withdrawn after publishing
7 years old
100 releases · first in 2019
7 releases in the last 12 months
see the full history below
Release timeline
100 releases · Sep 2019 to Jan 2026Releases
latest 60 of 100-
6.3.027 Jan 2026Nothing published for this version
-
6.2.026 Jan 2026Release notes
Open source →-
BREAKING -the currency json format has three new fields, isIso, isDepreated, replacedBy; The fromJson method will set isIso to true, isDrerecated to false and replacedBy to null if they are not present.
-
FIX the Chilean Peso group and decimal separators where reversed, now corrected.
-
FIX spelling of the name of some currencies in line with theiso standards. Djibouti Franc -> Djiboutian Franc CFA Franc BEAC -> Central African CFA Franc
-
FIX some currency use a non-breaking space as per the ISO standard, for the group separator, these have been changed from a normal space for: GNF, XPF
-
FIX the number of decimal palces for the TWD has changed from 2 to 0.
-
Change the source of currencies to 'https://www.six-group.com/dam/download/financial-information/data-center/' 'iso-currrency/lists/list-one.xml'; 'https://raw.githubusercontent.com/unicode-org/cldr-json/48.0.0/cldr-json';
-
add some 30 missing currencies.
-
added some 12 digital currencies.
-
FIXED #99.
-
-
6.1.030 Dec 2025Release notes
Open source →- There is a merge (of most) of #97 submitted by @fabiocarneiro - thanks to fabio for his excellent work.
- Robust Decimal/Group Separator Heuristic: A new heuristic dynamically detects decimalSeparator and groupSeparator by analyzing the input string's structure (presence and position of . and ,). This allows Money.parse to correctly interpret formats like 1,246.98 (treating . as decimal) even for EUR, which defaults to ,.
- The heuristic is only applied if both separators are present in the input to prevent input such as 9,00 being mis-interpreted as 900 rather than 9.
- Accurate Major/Minor Unit Extraction: The ValueQueue._takeDigits method was refined to strictly differentiate between digits, group separators, and the detected decimal separator. This ensures major units stop precisely at the decimal point.
- Correct Truncation/Scaling Flow: PatternDecoder now extracts the full precision of minor units from the input string. The Fixed amount is then constructed with this full parsed precision. The final truncation or scaling to currency.decimalDigits (as per the "excess digits will be ignored" rule) is handled correctly by Fixed.copyWith during the Money object creation.
- Precise Negative Number Handling: The calculation of the final value now combines the absolute major and minor units first, and then applies the negative sign (if isNegative is true) to this combined absolute value, preventing off-by-one errors for negative inputs.
- Improved _isDigit: The _isDigit method was corrected to strictly identify only 0-9 characters as digits, preventing separators from being misinterpreted as numerical values.
-
6.0.915 Oct 2025 -
6.0.815 Oct 2025 -
6.0.715 Oct 2025Release notes
Open source →- updated the readme with more detail and improved the pubspec description.
- We now generate an md file with the full list of currency codes and their settings.
- Fixed a spelling mistake in the currencies.yaml file.
-
6.0.613 Oct 2025Release notes
Open source →- now allows a -ve sign before the currency symbol. Fixed a bug in the pattern which included = rather than -.
-
6.0.513 Aug 2025 -
6.0.413 Aug 2025Release notes
Open source →- removed the dependency on strings package by copying a the two functions we used into money2.
-
6.0.325 Jun 2025Release notes
Open source →- Fixeds #96. Change the generator so if the symbol contains a $ we prefix the string with 'r'.
- spelling.
-
6.0.224 May 2025Nothing published for this version
-
6.0.2-beta.224 May 2025 pre-releaseRelease notes
Open source →- Fixes issue with trailing Currency isoCodes throwing a range exception as reported in #95.
-
6.0.2-beta.124 May 2025 pre-releaseRelease notes
Open source →- BREAKING: Fixes #95. This problem was a regression caused as part of the 6.x release.
The issue was that group separators after the first (right most) group where
being treated incorrectly.
We now treat #,### == ###,### and ##,### == ##,###
We also fixed a long standing issue with common currences. All CommonCurrencies has been defined without group separators. This has now been changed so that all common currencies are defined with the appropriate group separators.
This means that the pattern for USD (and most other currencies) changes from S0.00 to S#,##0.00. All common currencies are now defined with group separators as appropriate for that currency.
The implication is that formatting with the old behavour would give $9000 whilst the new behavour would give $9,000. If you want to mimic the old behaviour you can simply set the pattern to the original 'S0.00'.
We have also changed how we are maintaing common currencies. We are are now generating common currencies from a yaml file. To regenerate common currences run: dart tool/generate_common_currencies.dart
- BREAKING: Fixes #95. This problem was a regression caused as part of the 6.x release.
The issue was that group separators after the first (right most) group where
being treated incorrectly.
-
6.0.110 May 2025 -
6.0.026 Apr 2025Release notes
Open source →- Breaking All occurances of the Precentage named arg 'scale' have been changed to decimalDigits.
- change all occurance of scale to decimalDigits. Upgraded to Fixed 6.0
-
6.0.0-beta.418 Apr 2025 pre-releaseRelease notes
Open source →- Breaking: Money operator * now returns the same decimalDigits as the original Money instance. Previously we use the Currencies decimal Digits.
- upgraded to fixed 5.3.4
- Fixed broken examples in the readme and the main doco site.
- Fixed a bug in operator * which truncated the scale of doubles. We now default to 16 digits.
- Added a new method multiplyByNum to allow the user to expliclity control the scale.
- created tests for all examples.
- Added missing hkd from list of common currencies. Thanks to @hwh97 for raising the issue.
-
6.0.0-beta.323 Mar 2025 pre-releaseRelease notes
Open source →BREAKING: change fromCode and toCode to fromIsoCode and toIsoCode in the ExchangeRate.fromMinorUnits and ExchangeRate.fromNum methods to bring it in line with other methods. Change how ExchangeRates are stored to json to bring it in line with how we store money as json.
/// old format Map<String, dynamic> toJson() => { 'integerPart': 0, 'decimalPart': 68 'decimals': 2, 'fromIsoCode': 'AUD' 'toIsoCode': 'USD' 'toDecimalDigits': 3, }; /// new format 'minorUnits': '75312', 'decimals': 5, 'fromIsoCode': 'AUD', 'toIsoCode': 'USD', 'toDecimals': 3,Note that 'minorUnits' is a string to avoid overflow issues when javascript parses the json and the integer is larger than a javascript num.
-
6.0.0-beta.223 Mar 2025 pre-releaseRelease notes
Open source →BREAKING: the 'precision' argument to Currencies.copyWith has been renamed from precision to decimalDigits
-
6.0.0-beta.116 Mar 2025 pre-releaseRelease notes
Open source →-
Add: support for large numbers. Thanks to @nesquikm's significant contribution we now support numbers upto 100 digits (in both the integer and decimal components) and the library probably works for larger numbers as well - we use BigInt under the hood which is only limited by memory.
-
New formatting engine. We have done a complete rewrite of the engine that formats money amounts which has alowed us to fix a number of long time outstanding issue. In particular we now support the india clustering of thousands '##,###.##' and in general the engine should prove to be much more flexible.
-
Add: we now support the '+' character in a pattern. When present we will either print '+' or '-' based on the sign of the number. This compares with the '-' pattern which will print a '-' (if the amount is -ve) but never a '+' character.
-
Breaking: a pattern for the integer component like '0#' is now illegal and will throw. If used the '0' character can only come after any '#' character e.g. '#0' is allowed.
-
Breaking: a pattern for the decimal component like 'xxxx.#0' is now illegal and will throw. If used the '0' character must come before any '#' character e.g. 'xxx.0#' is allowed.
-
Breaking: change the json format as the current format was likely to break any javascript code that tried to parse it when it contained a large number. Given the breaking change we also took the opportunity to improve the format. We now have 'minorUnits', 'decimals' and 'isoCode' as the three fields.
For example to store the value USD $10.25
The old format contained four fields:
'integerPart': 10 'decimalPart': 25 'decimals': 2 'isoCode': 'USD"The new format only has 3 fields and the minor units are a string to avoid javascript consumers throwing on big values:
final expectedJson = <String, dynamic>{ 'minorUnits': '1025', 'decimals': 2, 'isoCode': 'USD', };- Additional IllegalPatternException are now thrown when formatting a number if the pattern is invalid.
-
-
5.4.607 Dec 2024Release notes
Open source →- modified Percentage.tryParse to return null if the amount can't be parsed. Previoulsy we returned zero which isn't in keeping with the expected signature a tryParse method.
-
5.4.506 Dec 2024 -
5.4.430 Nov 2024Release notes
Open source →- Fixed a bug in the multipledByPercent, it was failing to divide by 100 after we changed the way percentages are represented.
-
5.4.330 Nov 2024Release notes
Open source →-
added additional tests.
-
fixed arg names to divide methods.
-
added methods multipliedByPercentage percentageOf
-
added helper class Percentage. as a whole number rather than a decimal e.g. 10% is stored as 10 not 0.1
-
-
5.4.230 Nov 2024 withdrawnNothing published for this version
-
5.4.129 Nov 2024 withdrawnNothing published for this version
-
5.4.005 Nov 2024Release notes
Open source →- added json serialisation to Money, Currency and ExchangeRate A big thanks to https://github.com/marcelomendoncasoares for this excellent contribution.
-
5.3.024 Sep 2024Release notes
Open source →- Merge pull request #88 from bryanoltman/bo/fix-typo
- fix typo in README.md
- upgraded to decmial 3.x
-
5.2.103 Aug 2024 -
5.2.003 Aug 2024Release notes
Open source →- added a test to check for inequality when the 'other' type is not a money now that we accept an Object? for other.
- Merge pull request #86 from karelklic/operator== which now takes an Object? for other so that we work with the likes of the freezed package.
-
5.1.001 Jul 2024Release notes
Open source →- Added additional conversion operations. Upgraded to Fixed 5.0.
- released 5.0.1
-
5.0.104 Apr 2024Nothing published for this version
-
5.0.004 Apr 2024Release notes
Open source →The driver for this release and the breaking changes comes from: https://github.com/onepub-dev/money.dart/issues/79
The aim is to allow users to fully customise the group and decimal separators. We have also renamed 'scale' to 'decimalDigits' as this term is likely to be more familiar to users.
breaking changes
- The 'invertSeparator' argument to the Currency class has been broken out into two separate arguments 'groupSeparator' and 'decimalSeparator'. If you are using 'invertSeparator: true' then you need to replace this with
groupSeparator: '.', decimalSeparator: ',',- patterns used for parsing and formatting must always use ',' for group separators and '.' for decimal separators regardless of what has been used for the groupSeparator and decimalSeparator. This allows a single pattern to be used across currencies rather than having to create a unique pattern for each currency when looking to use custom formats.
This means that if you have been using 'invertSeparator: true' then you will need to modifiy any custom patterns from '#.###,##' to '#,###.##'. Note the change in the separators!
-
For methods that take a 'code' it has been renamed 'isoCode' to make the correct use of the code more apparent.
-
renamed PatterDecoder.isCode to isIsoCode
-
renamed CurrencyCode to CurrencyIsoCode
-
renamed all occurances of 'scale' to 'decimalDigits' as many people are not familiar with the concept of scale.
-
changed toScale on ExchangeRate members to be 'toDecimalDigits'.
non-breaking changes
- Fixed doco for Currencies class as it is a singleton and it's needs methods need to be called via Currencies()...
Full set of currency codes
Thanks to the work of fueripe-desu we now have a full set of currency codes and associated formatting built into common-currencies. An heroic piece of work - so much thanks to fueripe-desu from myself and the wider Dart community.
-
5.0.0-alpha.218 Feb 2024 pre-release -
5.0.0-alpha.118 Feb 2024 pre-releaseRelease notes
Open source →The driver for this release and the breaking changes comes from: https://github.com/onepub-dev/money.dart/issues/79
The aim is to allow users to fully customise the group and decimal separators. We have also renamed 'scale' to 'decimalDigits' as this term is likely to be more familiar to users.
breaking changes
- The 'invertSeparator' argument to the Currency class has been broken out into two separate arguments 'groupSeparator' and 'decimalSeparator'. If you are using 'invertSeparator: true' then you need to replace this with
groupSeparator: '.', decimalSeparator: ',',- patterns used for parsing and formatting must always use ',' for group separators and '.' for decimal separators regardless of what has been used for the groupSeparator and decimalSeparator. This allows a single pattern to be used across currencies rather than having to create a unique pattern for each currency when looking to use custom formats.
This means that if you have been using 'invertSeparator: true' then you will need to modifiy any custom patterns from '#.###,##' to '#,###.##'. Note the change in the separators!
-
For methods that take a 'code' it has been renamed 'isoCode' to make the correct use of the code more apparent.
-
renamed PatterDecoder.isCode to isIsoCode
-
renamed CurrencyCode to CurrencyIsoCode
-
renamed all occurances of 'scale' to 'decimalDigits' as many people are not familiar with the concept of scale.
-
changed toScale on ExchangeRate members to be 'toDecimalDigits'.
non-breaking changes
- Fixed doco for Currencies class as it is a singleton and it's needs methods need to be called via Currencies()...
-
4.1.017 Feb 2024 -
4.0.001 Aug 2023Release notes
Open source →- updated min sdk to 3.x
- updated to fixed 4.x
- test: add test for trailing symbol pattern
-
3.4.128 Apr 2023Release notes
Open source →- fix(pattern_encoder): handle trailing decimal when pattern has trailing symbol
- Added scale unit tests provided by @nesquikm
-
3.4.013 Mar 2023 -
3.3.010 Sep 2022Release notes
Open source →- Upgraded to fixed 2.3.0 and Decimal 2.3.0 to fixed a compilation problem caused by a breaking change in decimal. upgraded to lint_hard. Increased the minimum sdk to 2.14 as reflect decimals minimum sdk.
-
3.2.031 Aug 2022Release notes
Open source →- updated to the latest version of decimal, fixed and meta.
- BREAKING: The exchange rate formatter was incorrectly displaying the rate as a currency when its just a scalar value. The currency symbol prefix has now been removed. The exchange rate format was also performing rounding when the scale was larger than the no. of decimals the format included. This was not the intended behaviour. It now truncates the no. of decimals to reflect the format pattern. If you want rounding then you should scale the no. before formatting it.
-
3.1.425 Aug 2022Release notes
Open source →- Fixed: #69 - tryParse throws when Money empty - thanks to LewisHolliday
- add failing tryParse tests
- add tests for parse with invalid input
- Money.parse now correctly throws MoneyParseException when an invalid amount is passed.
-
3.1.304 Jun 2022Release notes
Open source →- exported money_data.dart in the barrel file.
- corrected spelling for Money.fromBigIntWitCurrency and ExchangeRate.fromFixedWitCurrency
- updated links from noojee.dev to onepub.dev
-
3.1.3-beta.109 Feb 2022 pre-releaseNothing published for this version
-
3.1.221 Dec 2021 -
3.1.020 Dec 2021Release notes
Open source →- Merge pull request #59 from niklasbartsch/Upraded-to-the-latest-version-of-fixed
- Fixes: error when using Money2 in a Flutter Web environment due to the reduced size of an int (53bits vs 64 bits).
-
3.0.027 Nov 2021Nothing published for this version
-
3.0.0-beta222 Nov 2021 pre-releaseRelease notes
Open source →- added notes on v2-v3 conversion.
- Changed ExchangePlatform to work with ExchangeRate changes.
- Added ctors to ExchangeRate for the supported data types.
- Added a method to apply an inverse rate. Added the from Currency so it could be used in the ExchangePlatform and is fully self desribing.
- Fixed the # char for decimal patterns as it was acting like the 0 char.
- Made the Code and Symbol patterns optional.
- renamed Money.from to Money.fromNum.
- Added Money.fromIntWithCurrency.
- Added Money.fromDecimal
- Added operators for Money and Fixed operations.
- Change all exceptions to be derived from a common MoneyException.
- Updated bitcoins pattern to make it consistent with other currencies.
- Added the exchange_platform to the set of exported classes.
- Added decimalPart to moneyData.
- Added sign to Money.
-
3.0.0-beta.630 Jul 2021 pre-releaseRelease notes
Open source →- Added additional tests for INR.
- INR had invertseparator as true which isn't correct for INR. The pattern was also wrong.
-
3.0.0-beta.530 Jul 2021 pre-releaseRelease notes
Open source →Change the common currency format for the inr currencies as it was inconsistent with all other default formats. This also sides steps bug #50.
-
3.0.0-beta.418 Jul 2021 pre-releaseRelease notes
Open source →- reverted meta to 1.3 as flutter_test isn't compatible with meta 1.7 Fixes: #47
-
3.0.0-beta.317 Jul 2021 pre-releaseRelease notes
Open source →- upgraded to latest meta.
- moved to lints package.
- added [] and []= operators to access Currencies.
- cleaned up package imports.
-
3.0.0-beta.216 Jul 2021 pre-releaseRelease notes
Open source →Revised the Money constructors to take a currency 'code' rather than a currency.
Money.from(100, CommonCurrency.usd); becomes Money.from(100, 'USD'); Old methods are still available as: Money.fromWithCurrency(100, CommonCurrency.usd);To support this CommonCurrencies are now automatically registered.
-
3.0.0-beta.116 Jul 2021 pre-releaseRelease notes
Open source →Breaking changes
- re-implemented each of the == operator to use 'covariant' rather than taking a dynamic as this moves the type check to a compile time error rather than a runtime error. You can nolonger pass a dynamic to the == operator.
- Changed the Currencies class to a singleton as per #38. You will need to change calls such as:
Currencies.register() -> Currences().register(); Currencies.registerAll() -> Currences().registerAll(); Currencies.parse() -> Currences().parse();- restructured the unit test directory so it confirms to the recommended structure.
-
2.3.006 Nov 2021Release notes
Open source →- In response to issue #53 we have modified how excess minorUnits (decimals) are parsed. Even if the parse pattern doesn't contain decimal places we will still parse decimal places in the Monetary Value. This ensures that we always retain the original parsed values precisions. However the api is currently quiet on how precision is treated when parsing decimals. We have now documented the api to state that we will parse upto the Currencies defined precisions.
-
- This means: if you pass a monetary value with decimal digits in excess of the Currencies precision they will be ignored. If you pass a monetary value with decimal digits in excess of the passed pattern then they will be parsed upto the precision of the Currency.
- Fixed a bug where parsing a no. of the form '.99' (i.e. no leading major digit) would thrown an exception.
-
2.2.303 Oct 2021Nothing published for this version
-
2.2.230 Sep 2021Release notes
Open source →- Fix overflow issue when using high precision currencies - thanks to Bob Jackman for the contribution.
-
2.2.117 Jun 2021 -
2.2.016 Jun 2021Release notes
Open source →- Add API to access currently registered currencies
Iterator<Currency> Currencies.getRegistered() -
2.1.411 Jun 2021 -
2.1.311 Jun 2021