toJson method Null safety

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() => {
      "id": id,
      "name": name,
      "childern": childern == null
          ? null
          : List<dynamic>.from(childern!.map((x) => x.toJson())),
      "listType": listType,
      "imgURL": imgUrl,
      "imgThumbURL": imgThumbUrl,
      "hasFilter": hasFilter,
    };