I am relatively new to flutter. I have been dealing with flutter code base written by previous developer. So whenever i navigate to history page in the app it throws exception stating type 'String' is not a subtype of type 'Timestamp'. I have no clue what's wrong with the code. any help would be apprecated. I have been stuck for a couple of days now. type of createddate is string.
docs.documents.forEach((i) {
Timestamp date = i.data['createddate'];
DateTime dates = date.toDate();
DateFormat inputFormat = DateFormat("yyyy-MM-dd HH:mm:ss");
DateTime parsedDate = inputFormat.parse(dates.toString());
print(approvestatus + 'dada');
if ((filterFrom
.subtract(Duration(hours: 24))
.isBefore(parsedDate) &&
filterTo
.add(Duration(hours: 24))
.isAfter(parsedDate)) &&
(i.data['shopkeeperid'].toString() == uid) &&
(i.data['productid']
.toString()
.toLowerCase()
.contains(searchvalue.toString()) ||
i.data['productname']
.toString()
.toLowerCase()
.contains(searchvalue.toString()) ||
i.data['productbrand']
.toString()
.toLowerCase()
.contains(searchvalue.toString()) ||
i.data['availablequantity']
.toString()
.toLowerCase()
.contains(searchvalue.toString()) ||
searchvalue == "")) {
childrenWidgets.add(productView(i, context));
}
});