// To parse this JSON data, do // // final publications = publicationsFromJson(jsonString); import 'dart:convert'; List publicationsFromJson(String str) => List.from( json.decode(str).map((x) => Publications.fromJson(x))); String publicationsToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); class Publications { int id; int userId; String articalTitle; String journalName; DateTime date; String author; dynamic createdAt; dynamic updatedAt; Publications({ required this.id, required this.userId, required this.articalTitle, required this.journalName, required this.date, required this.author, required this.createdAt, required this.updatedAt, }); factory Publications.fromJson(Map json) => Publications( id: json["id"], userId: json["user_id"], articalTitle: json["artical_title"], journalName: json["journal_name"], date: DateTime.parse(json["date"]), author: json["author"], createdAt: json["created_at"], updatedAt: json["updated_at"], ); Map toJson() => { "id": id, "user_id": userId, "artical_title": articalTitle, "journal_name": journalName, "date": date.toIso8601String(), "author": author, "created_at": createdAt, "updated_at": updatedAt, }; }