Flutter Error: Unexpected null value in debug console

Viewed 27

I am using where clause to filter out what user is typing with the api result but I am getting Error: Unexpected null value. I am using a post request.

my code with error

this is my model :-

   class SearchSquad {
  SearchSquad({
    required this.count,
    required this.res,
  });

  int count;
  List<Re> res;

  factory SearchSquad.fromJson(Map<String, dynamic> json) => SearchSquad(
        count: json["count"],
        res: List<Re>.from(json["res"].map((x) => Re.fromJson(x))),
      );

  Map<String, dynamic> toJson() => {
        "count": count,
        "res": List<dynamic>.from(res.map((x) => x.toJson())),
      };
}

class Re {
  Re({        
    required this.squadName,       
    required this.profimgname,
    required this.profimgurl,
    
  });

  String squadId;
  String squadName;

My error

0 Answers
Related