tafkeet 1.2.1
tafkeet: ^1.2.1 copied to clipboard
Convert numbers to words in Arabic and English with 90+ currency support. Includes extensions for double, int, and String types.
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.
1.2.1 - 2025-12-09 #
๐ Changed #
- Default Prefix and Suffix: Changed default values for
prefixandsuffixparameters to empty strings ('') instead of'ููุท ูุง ุบูุฑ'(Arabic) and'only'(English)- This gives users full control over prefix and suffix text
- Users can now add custom prefix/suffix only when needed
- All examples in README updated to reflect this change
๐ Documentation #
- Updated all examples in README.md to show empty default prefix/suffix
- Added clarification that prefix and suffix are empty by default
- Updated example outputs to remove default suffix text
1.2.0 - 2025-12-09 #
โจ New Features #
Arabic-Indic Numerals Support
- Automatic Conversion: String extension now automatically converts Arabic-Indic digits (ู ูกูขูฃูคูฅูฆูงูจูฉ) to Western digits
replaceArabicNumber(): New static method inNumberUtilsto convert Arabic numerals to EnglishreplaceArabicNumbers(): New extension onStringfor easy numeral conversion- Works seamlessly with
tafkeet()- Arabic numerals are automatically handled
'ูกูขูฃ'.tafkeet(lang: Lang.ar); // Automatically converts and processes
'ูฅู ู '.replaceArabicNumbers(); // Returns: '500'
NumberUtils.replaceArabicNumber('ุงูุณุนุฑ: ูฉูฉูฉ'); // Returns: 'ุงูุณุนุฑ: 999'
Number Formatting
amountFormat(): New method to format numbers with thousand separators (commas)- Extensions on all numeric types: Available on
double,int, andString - Decimal Precision Control: Use
digitparameter to control decimal places - Arabic Numerals Support: Works with both Western and Arabic-Indic digits
- Smart Validation: Returns original string if input is not a valid number
// Format with thousand separators
1234567.amountFormat(); // Returns: '1,234,567'
1234567.89.amountFormat(digit: 2); // Returns: '1,234,567.89'
// Works with strings and Arabic numerals
'ูกูขูฃูคูฅูฆูง'.amountFormat(); // Returns: '1,234,567'
'1234567.89'.amountFormat(digit: 2); // Returns: '1,234,567.89'
// Combine with tafkeet
final amount = 1234567.89;
print(amount.amountFormat(digit: 2)); // 1,234,567.89
print(amount.tafkeet(lang: Lang.ar, currency: Currency.SAR));
๐ Documentation #
- Added comprehensive documentation for Arabic-Indic numerals support in README
- Added "Number Formatting" section with examples
- Updated all examples to showcase new features
- Added 7 new examples in
example/main.dart(Examples 24-30)
๐งช Testing #
- Added 11 new unit tests for
amountFormat()functionality - Added 8 new unit tests for Arabic numerals conversion
- Total test count: 32 tests (all passing โ )
๐ฆ Package Updates #
- Updated package description
- Package size: 21 KB (compressed)
- All code comments and documentation in English
1.0.0 - 2025-12-09 #
๐ Initial Release #
First stable release of Tafkeet - A comprehensive Flutter package for converting numbers to words in Arabic and English.
โจ Features #
Core Functionality
- Number to Words Conversion: Convert numbers to words in Arabic and English
- Dual Language Support: Full support for Arabic (
Lang.ar) and English (Lang.en) - Large Number Support: Handle numbers up to trillions
- Decimal Support: Convert decimal numbers with automatic rounding based on currency precision (
partPrecision) - Gender-Aware: Correct masculine/feminine handling based on currency type
Currency Support
- 90+ World Currencies: Support for over 90 currencies from around the world
- 21 Arabic Currencies: SAR, AED, KWD, QAR, OMR, BHD, EGP, SYP, JOD, LBP, IQD, YER, LYD, TND, DZD, MAD, SDG, SOS, MRU, DJF, KMF
- Major World Currencies: USD, EUR, GBP, JPY, CHF, CAD, AUD, NZD, CNY, INR, RUB, BRL, ZAR, SEK, NOK, DKK, PLN, TRY, and more
- Custom Currency Support: Add, update, or remove custom currencies
- Currency Groups:
Currency.arabicCurrenciesandCurrency.majorCurrenciesgetters
API & Extensions
- Simple API:
Tafkeet.convert(number, lang: Lang.ar, currency: Currency.SAR) - Type Extensions: Convert numbers directly with
.tafkeet()methoddoubleextension:120.5.tafkeet(lang: Lang.ar)intextension:250.tafkeet(lang: Lang.en)Stringextension:'75.25'.tafkeet()with automatic number validation- Arabic-Indic Numerals Support: Automatically converts Arabic numerals (ู ูกูขูฃูคูฅูฆูงูจูฉ) in String extension
- Arabic Numerals Replacement:
NumberUtils.replaceArabicNumber()- Convert Arabic-Indic digits to Western digitsString.replaceArabicNumbers()extension - Convert numerals directly on strings
- Number Formatting:
NumberUtils.amountFormat()- Format numbers with thousand separators (commas).amountFormat()extension ondouble,int, andString- Format numbers directly- Supports decimal precision control with
digitparameter - Works with Arabic-Indic numerals
- Configuration:
Tafkeet.configure()for setting default language and currency - Custom Prefix/Suffix: Add custom text before and after converted numbers
Currency Management
CurrencyConfig.addCurrency()- Add custom currenciesCurrencyConfig.updateCurrency()- Update existing currency settingsCurrencyConfig.removeCurrency()- Remove currenciesCurrencyConfig.getCurrency()- Get currency informationCurrencyConfig.hasCurrency()- Check if currency existsCurrencyConfig.getAllCurrencies()- Get all available currenciesCurrencyConfig.reset()- Reset to default configuration
Developer Experience
- Well-Organized Structure: Clean folder structure with separate modules
- Comprehensive Documentation: Full English documentation with examples
- Type Safety: Strong typing with enums for languages and currencies
- Extensible: Easy to add new languages or currencies
- Tested: Full test coverage with 13+ unit tests
๐ฆ Package Structure #
lib/
โโโ tafkeet.dart # Main entry point
โโโ tafkeet/
โ โโโ tafkeet.dart # Core conversion class
โ โโโ models/
โ โ โโโ language.dart # Language enum (Lang.ar, Lang.en)
โ โ โโโ currency.dart # Currency enum (90+ currencies)
โ โ โโโ currency_info.dart # Currency information model
โ โโโ config/
โ โ โโโ currency_config.dart # Currency configuration manager
โ โโโ converters/
โ โ โโโ arabic_converter.dart # Arabic number conversion logic
โ โ โโโ english_converter.dart # English number conversion logic
โ โโโ extensions/
โ โ โโโ double_extension.dart # Extension on double
โ โ โโโ int_extension.dart # Extension on int
โ โ โโโ string_extension.dart # Extension on String
โ โโโ utils/
โ โโโ number_utils.dart # Number utility functions
๐ง Technical Details #
- Minimum SDK: Dart 3.0.0
- Flutter: 1.17.0 or higher
- License: MIT
- Code Quality: All code comments in English
- Documentation: Complete README.md with usage examples
๐ Examples #
// Basic conversion
Tafkeet.convert(120, lang: Lang.ar);
// With currency
Tafkeet.convert(250.50, lang: Lang.ar, currency: Currency.SAR);
// Using extensions
120.tafkeet(lang: Lang.ar);
'75.25'.tafkeet(currency: Currency.USD);
// Arabic-Indic numerals support
'ูกูขูฃ'.tafkeet(lang: Lang.ar); // Automatically converts ูกูขูฃ to 123
'ูฅู ู '.replaceArabicNumbers(); // Returns: '500'
// Number formatting with thousand separators
1234567.amountFormat(); // Returns: '1,234,567'
1234567.89.amountFormat(digit: 2); // Returns: '1,234,567.89'
'ูกูขูฃูคูฅูฆูง'.amountFormat(); // Returns: '1,234,567'
// Configure defaults
Tafkeet.configure(defaultLang: Lang.ar, defaultCurrency: Currency.SAR);
// Decimal rounding (automatic based on partPrecision)
Tafkeet.convert(19002.989, lang: Lang.ar, currency: Currency.SAR);
// 19002.989 โ rounded to 19002.99 (2 decimal places)
// Result: ุชุณุนุฉ ุนุดุฑ ุฃูู ู ุงุซูุงู ุฑูุงู ุณุนูุฏู ู ุชุณุนุฉ ู ุชุณุนูู ูููุฉ
๐ Supported Languages #
- Arabic (ar) - ุงูุนุฑุจูุฉ
- English (en)
๐ฐ Currency Support #
- Total: 91 currencies
- Arabic: 21 currencies
- Major: 10+ major world currencies
- Custom: Unlimited custom currencies via configuration
Future Plans #
- Add more languages (French, Spanish, etc.)
- Add more currency configurations
- Improve performance for very large numbers
- Add more customization options