I've created a small function which uses the timeago imported library within FF.
However as my application is a multi language application, i was trying to leverage timeago ability to localize messages. This is a sample code to reproduce it
String formatDateLocalized(int secondsSinceEpoch, String languageCode) {
final date = DateTime
.fromMillisecondsSinceEpoch(secondsSinceEpoch * 1000);
final lang = languageCode.toLowerCase();
return timeago.format(date, locale: lang);
}
This code generate the following lines in the console:
flutter: Locale [de] has not been added, using [en] as fallback. To add a locale use [setLocaleMessages]
The solution is to call [setLocaleMessages]
before calling the function however I think it would be nicer if these calls [setLocaleMessages]
are included in the generated code whenever the project is setup for multi language.