class ReadBy { int id, messageId; List ids; ReadBy({required this.id, required this.ids, required this.messageId}); factory ReadBy.fromJson(Map jsonMap) => ReadBy( id: jsonMap['id'], messageId: jsonMap['messageId'], ids: parsedIdsList(jsonMap['ids']), ); static List parsedIdsList(String idsString) { List parsedList = []; String temp = ''; for (int i = 0; i < idsString.length; i++) { if (idsString[i] == ',' && temp != '') { parsedList.add(int.parse(temp)); temp = ''; } else { if (idsString[i] != ',') { temp = temp + idsString[i]; } } } return parsedList; } bool isReaded() { if (ids.length > 1) { return true; } else { return false; } } }