localizedRelativeTime function

String localizedRelativeTime(
  1. DateTime date, [
  2. DateTime? relativeTo,
  3. String? locale
])

Formats a localized relative time string for the active locale on BloomI18n.instance.

final str = localizedRelativeTime(DateTime.now().subtract(const Duration(minutes: 5)));
// Returns: "5 minutes ago"

See also:

Implementation

String localizedRelativeTime(DateTime date, [DateTime? relativeTo, String? locale]) =>
    formatRelativeTime(date, relativeTo: relativeTo, locale: locale);