yearAsString function

String yearAsString (
  1. DateTime date
)

Returns given DateTime's year as a # String formatted YYYY (ex. '2019').

Implementation

String yearAsString(DateTime date) {
  return formatDate(date: date, format: 'YYYY');
}