formatAsLocalizedDate method

String formatAsLocalizedDate(
  1. BuildContext context
)

Formats the DateTime to a localized and human-readible string.

The formatted string will output the the day, the month and the year included in the DateTime.

For example the english localization of the corresponding DateTime will return April 10, 2021.

Implementation

String formatAsLocalizedDate(BuildContext context) {
  final DateFormat formatter =
      DateFormat.yMMMMd(Localizations.localeOf(context).languageCode);
  return formatter.format(this);
}