get_time_ago
3.0.1, released 7 weeks ago by nixrajput.com
Relative time formatting for Dart and Flutter supporting 22 locales and CLDR plurals.
WASM-ready
What it does
Turns a DateTime into relative text like "just now", "5 minutes ago", or "in 3 days". It runs in both Flutter and plain Dart with an injectable clock and multiple style options.
AI-written summary of version 3.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need relative timestamps in feeds, chats, notifications, or logs.
- You require correct CLDR plural rules for multiple languages.
- You need to run relative time formatting in pure Dart outside of Flutter.
Skip it when
- You need calendar phrasing like "yesterday" or "last week".
- You need multi-unit durations such as "2 hours 5 minutes".
Strengths
- Supports 22 locales with CLDR plurals and fallback mechanisms.
- Injectable clock for deterministic tests and server-corrected time.
- Provides nextChange helper for efficient UI refresh scheduling.
Weaknesses
- Occitan is restricted to long style due to lack of CLDR data.
- Months are fixed to 30 days and years to 365 days.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
final timeAgo = GetTimeAgo.parse(DateTime.now().subtract(const Duration(minutes: 5)));Alternatives
Packages that do the same job and could replace get_time_ago.
Works with
Packages commonly used together with get_time_ago: ones it builds on, ones built on it, and its own family.