Flutter error : A value of type 'OutletListModel' can't be assigned to a variable of type 'List<OutletListModel>?'

I have a error "A value of type ‘OutletListModel’ can’t be assigned to a variable of type ‘List?’"

so how to resolve this error

List<OutletListModel>? selectedData;

enter image description here

>Solution :

change the code line where the error appears with:

selectedData = [OutletListModel.fromJson(value.toJson())];

because selectedData expects an Array of OutletListModel;

Leave a Reply