orderByDate method
Implementation
List<Map<String, dynamic>> orderByDate(
{String field = 'createdAt', bool descending = false}) {
final sortedDocuments = collection.values.toList()
..sort((a, b) =>
DateTime.parse(a[field]).compareTo(DateTime.parse(a[field])));
return descending
? List<Map<String, dynamic>>.from(sortedDocuments.reversed.toList())
: List<Map<String, dynamic>>.from(sortedDocuments);
}