formatDate function

String formatDate(
  1. DateTime date
)

Manually sets the weekday and month because the 'en_US' locale might not be initialized.

Implementation

String formatDate(DateTime date) {
  date = date.toUtc();
  final weekday = _weekdays[date.weekday - 1];
  final month = _months[date.month - 1];
  return '$weekday, ${_pad(date.day)} $month ${date.year} ${_pad(date.hour)}:${_pad(date.minute)}:${_pad(date.second)} UTC';
}