intl4x
1.0.1, released 8 weeks ago by labs.dart.dev
A lightweight Dart library for locale‑sensitive formatting, collation, and plural rules.
WASM-ready
What it does
intl4x offers APIs to format dates, numbers, lists, and to perform locale‑aware collation and case mapping. It wraps ICU4X on native platforms and the browser Intl API on web, providing a consistent API across all targets.
AI-written summary of version 1.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need date, number, or list formatting that respects locale rules.
- You want a small, dependency‑free i18n library without pulling in the full intl package.
- You target multiple platforms (native, web, desktop) and need a single implementation.
- You need locale‑aware collation or case mapping for sorting or display purposes.
Skip it when
- You require full ICU features like currency, unit, or calendar display names that are not yet supported.
- You need advanced pluralization patterns beyond the provided API.
- You are already using a comprehensive i18n solution such as the official intl package and cannot replace it.
Strengths
- Small, modular API with minimal dependencies.
- Cross‑platform support via ICU4X and browser Intl.
- Provides locale‑aware collation and case mapping out of the box.
- No code generation or build_runner required.
Weaknesses
- Missing features: compact, percent, unit, currency formatting, and some display names.
- Still in preview; may receive breaking changes in future releases.
- Limited documentation compared to the official intl package.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Add `intl4x` to pubspec and import the desired entrypoints; no additional build steps.
import 'package:intl4x/datetime_format.dart';
final formatter = DateTimeFormat.yearMonthDayTime(
locale: Locale.parse('de-DE'),
length: DateTimeLength.long,
).withTimeZoneLong();
print(formatter.format(DateTime.now(), 'Europe/Berlin'));
Alternatives
Packages that do the same job and could replace intl4x.
Works with
Packages commonly used together with intl4x: ones it builds on, ones built on it, and its own family.