format method

String format({
  1. String pattern = 'dd-MM-yyyy',
})

Implementation

String format({String pattern = 'dd-MM-yyyy'}) {
  if (this == null) {
    return ""; // Return empty string if DateTime is null
  }
  return DateFormat(pattern).format(this!);
}