MBDateElement constructor
Initializes a date element with the dictionary returned by the MBurger APIs.
- Parameters:
dictionary
: Thedictionary
returned by the APIs.
Implementation
factory MBDateElement({required Map<String, dynamic> dictionary}) {
DateTime? date;
if (dictionary['value'] is String) {
DateFormat dateFormat = DateFormat('dd/MM/yyyy HH:mm');
String dateString = dictionary['value'] as String;
date = dateFormat.parse(dateString);
}
return MBDateElement._(
dictionary: dictionary,
date: date,
);
}