tryLocalizeTimestamp method
Parses the given number as a date representing the seconds since epoch, and returns the localized version of the date based on the given pattern.
Uses the underlying date localize use case provided by dateLocalizeUseCaseProvider within the surrounding provider scope.
Returns null if the given num is null.
Implementation
String? tryLocalizeTimestamp(num? secondsSinceEpoch, String pattern) {
final localizeDate =
ProviderScope.containerOf(this).read(dateLocalizeUseCaseProvider);
final locale = Localizations.maybeLocaleOf(this)?.toLanguageTag();
if (secondsSinceEpoch == null) return null;
final date = DateTime.fromMillisecondsSinceEpoch(
(secondsSinceEpoch * 1000).round(),
);
return localizeDate(date, pattern, locale);
}