fromMap static method
Implementation
static Metadata fromMap(Map<String, dynamic> map) {
Map<String, dynamic> meta = map["metaData"] ?? map;
String id = meta["id"] ??
meta["_id"] ??
map["id"] ??
map["_id"] ??
HarnUtils.generateId();
String create = meta["createdAt"] ??
meta["created_at"] ??
map["createdAt"] ??
map["created_at"] ??
HarnUtils.generateTimeStamp();
String update = meta["updatedAt"] ??
meta["updated_at"] ??
map["updatedAt"] ??
map["updated_at"] ??
HarnUtils.generateTimeStamp();
return Metadata(
id: id,
createdAt: DateTime.parse(create),
updatedAt: DateTime.parse(update),
);
}