class Post { String? postID; DateTime? timestamp; String? playbackID; String? publisherID; String? title; String? assetID; String? aspect; String? rendition; Post({ this.postID, this.playbackID, this.publisherID, this.title, this.timestamp, this.assetID, this.aspect, this.rendition, }); factory Post.fromJSON(Map json) { return Post( publisherID: json["publisherId"], postID: json["postId"], title: json["title"], playbackID: json["playbackID"], assetID: json["assetID"], aspect: json["aspect"], rendition: json["rendition"], timestamp: DateTime.tryParse(json["timestamp"].toString())); } Map toJson() { final Map data = Map(); data['publisherId'] = this.publisherID; data['postId'] = this.postID; data['playbackID'] = this.playbackID; data['title'] = this.title; data['timestamp'] = this.timestamp!.toIso8601String(); data['assetID'] = this.assetID; data['aspect'] = this.aspect; data['rendition'] = this.rendition; return data; } @override String toString() { return '{"publisherId": "$publisherID", "postId": "$postID", "playbackID": "$playbackID","title":"$title","timestamp":' + '"$timestamp","assetID":"$assetID","aspect":"$aspect","rendition":"$rendition"}'; } }