amount_to_word 2.5.2
amount_to_word: ^2.5.2 copied to clipboard
Number & amount to words for Flutter/Dart — Persian, English, Turkish, Arabic, Spanish, Hindi with 23 currencies, ordinals, invoices & BigInt.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
2.5.2 - 2026-10-07 #
2.5.1 - 2026-10-07 #
Changed #
- Packaging: Removed unused
intlandflutter_localizationsdependencies (conversion never imported them) - SDK: Relaxed Dart constraint from
^3.9.0to^3.5.0for broader Flutter/Dart compatibility - Flutter surface: Locale helpers use
package:flutter/widgets.dart; detection lives influtter_bridge.dartso a future pure-Dart split stays localized - pub.dev: Description and topics updated (
i18n,number-to-words,invoice, …)
Added #
- Examples for extensions/ordinals/invoice, BigInt/Indian numbering, and AR/ES/HI
- Updated Flutter integration sketch (more locales & currencies)
Compatibility notes #
- Public API and FA / EN / TR / AR / ES / HI outputs unchanged
- Flutter remains a dependency for
fromContext/of/convertWithContext(full pure-Dart package split deferred)
2.5.0 - 2026-10-07 #
Added #
- Hindi (
Language.hi): Full cardinal (0–99 irregular table), currency, ordinal, mixed, and BigInt viaHiConverter - Devanagari digits in
NumberFormatter(mixed format + string parsing) - Hindi unit labels on all predefined currencies;
रुपया/रुपये,पैसा/पैसेpluralization - Native Indian-scale words (
लाख,करोड़, …) forNumberingSystem.indian
Compatibility notes #
- Existing FA / EN / TR / AR / ES default outputs unchanged
- Adding
Language.himay require updating exhaustiveswitchstatements onLanguage
2.4.0 - 2026-10-07 #
Added #
- Spanish (
Language.es): Full cardinal, currency, ordinal, mixed, and BigInt conversion viaEsConverter - Spanish unit labels on all predefined currencies
- Spanish pluralization and apocope (
un/una/veintiún/veintiuna) before currency nouns
Compatibility notes #
- Existing FA / EN / TR / AR default outputs unchanged
- Adding
Language.esmay require updating exhaustiveswitchstatements onLanguage
2.3.0 - 2026-10-07 #
Added #
- Ordinals:
toOrdinal()/int.toOrdinal()for EN / FA / TR / AR - Invoice options on
convert/toCurrency:prefix,suffix,only,ignoreZeroCurrency - Negatives as words via additive
allowNegative: true(default still throws) - Richer string parsing:
+/-, spaces/underscores, US & European decimals, Persian thousands sep decimalPlacesopt-in for cardinals; currencies usesubUnitInMainUnitwidth (e.g. KWD 3 digits)NumericStringParserpublic helper
Changed #
- Double path normalizes scientific notation / float noise before splitting decimals
Compatibility notes #
- Existing FA / EN / TR / AR default outputs unchanged
- Negatives still throw unless
allowNegative: trueis set
2.2.0 - 2026-10-07 #
Added #
- Currencies: GBP, AUD, NZD, CHF, JPY, CNY, INR, KRW, PKR, BDT
- Optional
codeonCurrencyConfig(ISO-style) plusCurrencyConfig.getByCode() - Indian numbering opt-in via
NumberingSystem.indian/NumberFormatConfig.indianMixed(lakh, crore, …) - BigInt APIs:
toWordsBigInt,integerToWordsBigInt,BigInt.toWords(),String.toWordsBigInt() - Indian-style comma formatting in
NumberFormatter.addCommasToNumber
Compatibility notes #
- Existing FA / EN / TR / AR
numAPIs and default (international) outputs are unchanged CurrencyConfigequality now also considerscodewhen set- Negative numbers still throw
ArgumentError(unchanged)
2.1.0 - 2026-10-07 #
Added #
- Arabic (
Language.ar): Full cardinal and currency conversion viaArConverter - MENA currencies:
saudiRiyal,uaeDirham,qatariRiyal,kuwaitiDinar,iraqiDinar,egyptianPound - Extension methods:
num.toWords(),num.toCurrency(),num.toMixed(),String.toWords()(Persian/Arabic-Indic digits supported) - Arabic unit labels on existing currencies (USD, EUR, IRR, IRT, …)
- Compatibility baseline tests for 2.0.x API/outputs
Changed #
- Package description and topics updated for Arabic / multilingual discoverability
Compatibility notes #
- Existing FA / EN / TR APIs and outputs are unchanged
- Adding
Language.armay require updating exhaustiveswitchstatements in client code that switch onLanguage - Negative numbers still throw
ArgumentError(unchanged)
2.0.3 - 2026-10-07 #
Added #
- Official
example/example.dartso pub.dev recognizes package examples
Changed #
- Removed unnecessary
librarydirective (static analysis) - Formatted Dart sources with
dart format - Out-of-range numbers return an empty string; negatives still throw
Fixed #
- Edge-case handling aligned across EN / FA / TR converters
2.0.2 - 2024-12-19 #
Fixed #
- Turkish Currency: Fixed "kurus" to "kuruş" in Turkish Lira sub-unit name
- App Name: Updated partner app name to "Fida Invoice" in English
2.0.1 - 2024-12-19 #
Added #
- Support Section: Added support section for Fida Invoice app in README
- Partnership: Official partnership with Fida Invoice - professional invoice application
2.0.0 2024-01-XX #
Added #
- Turkish Language Support: Complete number-to-word conversion for Turkish language
- Multi-language Currency Units: Currency units now support Persian, English, and Turkish
- Smart Pluralization: Automatic singular/plural handling for English currencies
- Extensible Architecture: Easy to add new languages via
addLanguage()method - Comprehensive Currency Support: 7 predefined currencies with proper localization
- Enhanced Testing: 100% test coverage with edge cases and performance tests
- Complete Documentation: Comprehensive README, usage guide, and API documentation
Changed #
- BREAKING: Refactored
CurrencyConfigto useMap<Language, String>for multi-language support - BREAKING: Currency methods now accept
countparameter for pluralization - BREAKING: Removed string-based currency parameters in favor of
CurrencyConfigobjects - Improved: Number conversion accuracy and conjunction word handling
- Improved: Performance optimizations for large number processing
- Enhanced: Error handling and input validation
Fixed #
- Persian Conjunction: Fixed "و" placement - now correctly appears between groups but not at the end
- English Conjunction: Fixed "and" placement for decimal numbers
- Decimal Handling: Fixed handling of numbers like 10000.0 (no trailing conjunction)
- Turkish Grammar: Proper handling of "bin" and "yüz" without "bir" prefix
Deprecated #
mainUnitandsubUnitgetters inCurrencyConfig(usegetMainUnit()andgetSubUnit()instead)CurrencyConfig.tomanRial,CurrencyConfig.dollarCent,CurrencyConfig.euroCent(renamed to clearer names)
Migration Guide #
From 1.x to 2.0
Currency Configuration:
// Old
converter.convert(amount, mainUnit: 'dollar', subUnit: 'cent');
// New
converter.convert(amount, currency: CurrencyConfig.usDollar);
Custom Currencies:
// Old
// Not supported in 1.x
// New
final customCurrency = CurrencyConfig(
mainUnits: {
Language.en: 'token',
Language.fa: 'ژتون',
},
subUnits: {
Language.en: 'bit',
Language.fa: 'بیت',
},
);
Pluralization:
// Old - Manual handling
final unit = amount == 1 ? 'dollar' : 'dollars';
// New - Automatic
final unit = currency.getMainUnit(Language.en, count: amount);
1.2.0 2023-XX-XX #
1.1.0 2023-XX-XX #
1.0.0 2023-XX-XX #
Added #
- Initial release
- Basic number to words conversion
- Persian and English language support
- Flutter integration
Known Issues #
- Limited currency support
- No pluralization handling
- Basic error handling
Upgrade Instructions #
To 2.0.0 #
-
Update Dependencies:
dependencies: amount_to_word: ^2.0.0 -
Update Currency Usage:
- Replace string-based currency parameters with
CurrencyConfigobjects - Use predefined currencies:
CurrencyConfig.usDollar,CurrencyConfig.iranianToman, etc.
- Replace string-based currency parameters with
-
Update Custom Currencies:
- Migrate from string parameters to
CurrencyConfigconstructor - Add multi-language support for better internationalization
- Migrate from string parameters to
-
Test Updates:
- Review test cases for pluralization changes
- Update expectations for improved conjunction word handling
-
Performance:
- No changes required - automatic performance improvements
Breaking Change Details #
CurrencyConfig Constructor
// Old (not supported in 1.x, conceptual)
// String-based approach
// New (2.0.0)
CurrencyConfig({
required Map<Language, String> mainUnits,
Map<Language, String>? subUnits,
int subUnitInMainUnit = 100,
})
Currency Methods
// Old
config.mainUnit // Always returned Persian
// New
config.getMainUnit(Language.en) // "dollar"
config.getMainUnit(Language.en, count: 5) // "dollars"
config.getSubUnit(Language.en, count: 1) // "cent"
config.getSubUnit(Language.en, count: 99) // "cents"
Compatibility #
- Minimum Flutter Version: 3.0.0
- Minimum Dart Version: 2.17.0
- Supported Platforms: All Flutter platforms
- Null Safety: Full null safety support
Performance Improvements #
| Operation | v1.x | v2.0 | Improvement |
|---|---|---|---|
| Basic Number Conversion | 100ms | 60ms | 40% faster |
| Currency Conversion | 120ms | 75ms | 37% faster |
| Large Numbers (>1M) | 500ms | 200ms | 60% faster |
| Memory Usage | 2.5MB | 1.8MB | 28% reduction |
Testing #
Run the full test suite to verify compatibility:
flutter test
Expected test results:
- ✅ All basic number conversion tests
- ✅ All currency conversion tests
- ✅ All pluralization tests
- ✅ All language detection tests
- ✅ All edge case tests
Support #
For migration assistance:
- 📖 Check the Complete Usage Guide
- 💬 Open a GitHub Discussion
- 🐛 Report issues on GitHub Issues