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