numeral
4.1.0, released 5 months ago by medz.dev
Composable number formatting and parsing for decimals, compact values, percentages, and locales.
What it does
Provides reusable codec classes for formatting and parsing numbers into localized or specialized display strings like percentages, byte sizes, currency, and compact values. Supports multiple languages including English, Chinese, French, Spanish, Japanese, and Korean.
AI-written summary of version 4.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to format and parse numbers, byte sizes, or percentages consistently using reusable codecs.
- You require locale-aware number formatting and parsing for languages like Chinese, French, Spanish, Japanese, or Korean.
Skip it when
- You need full internationalization (i18n) for complex texts, plurals, and messages beyond numeric values.
Strengths
- Bidirectional codecs that handle both formatting and parsing with the same object.
- Supports multiple language packs and custom unit sets.
- Extends `Codec` from `dart:convert` for standard-compliant usage.
Weaknesses
- Limited to number-related formatting and parsing rather than general i18n string translation.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:numeral/codec.dart';
import 'package:numeral/en.dart' as en;
final fileSize = BytesCodec.binary(maxFractionDigits: 1);
final compact = en.compact(maxFractionDigits: 1);
fileSize.format(1536); // 1.5 KiB
compact.format(12345); // 12.3KAlternatives
Packages that do the same job and could replace numeral.
- intl
A Dart library for internationalization and localization, providing message translation, plural/gender handling, and date/number formatting.
93Compare - locale_names
Provide locale display names in various locales via extensions on Locale from dart:ui.
46Compare - intl_translation
Generates Dart code for intl messages from ARB files for localization.
85Compare - l10n_currencies
Provides CLDR-like currency name translations for 149 locales in pure Dart with zero dependencies.
80Compare