formattedDate method
Formats the date using the locale from context.
Requires a Localizations ancestor above context (e.g. a
MaterialApp); otherwise Localizations.localeOf throws.
Implementation
String formattedDate(BuildContext context, {String pattern = 'yyyy-MM-dd'}) {
Locale locale = Localizations.localeOf(context);
return DateFormat(pattern, locale.toString()).format(this);
}