I was running unit test in flutter and I am getting error as
type ‘List’ is not a subtype of type ‘List<DocumentReference<Map<String, dynamic>>>’
The related code snippet is as follows where I am trying to read data from the firebase.
factory TimerSessionModel.fromSnapshot(
DocumentSnapshot<Map<String, dynamic>> snapshot) {
final data = snapshot.data()!;
return TimerSessionModel(
selfRef: snapshot.reference,
activeExecutionRef: data['activeExecutionRef'],
autoStartNextTimer: data['autoStartNextTimer'] as bool,
ownerRef: data['ownerRef'],
timerRefs: data['timerRefs'],
title: data['title'] as String,
);
}
Here timerRefs is a list of document references, where the problem is pointing to.
I tried to run the unit test and gives me and error as above mentioned
New contributor
M99Coder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1