You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

45 lines
1.2 KiB

import 'package:teso/Classes/TesoUser.dart';
import 'Post.dart';
class ThirdPerson {
TesoUser user;
List<Post> posts = <Post>[];
List following = [];
List friends = [];
String relation;
ThirdPerson({
this.user,
this.posts,
this.following,
this.friends,
this.relation,
});
factory ThirdPerson.fromJSON(Map<String, dynamic> json) {
var posts = json["posts"] as List;
List<Post> adverts = posts.map((e) => Post.fromJSON(e)).toList();
return ThirdPerson(
user: json["user"] != null ? TesoUser.fromJSON(json["user"]) : null,
posts: adverts != null ? adverts : <Post>[],
following: json["following"] as List,
friends: json["friends"] as List,
relation: json["relation"],
);
}
Map<dynamic, dynamic> toJson() {
final Map<dynamic, dynamic> data = Map<dynamic, dynamic>();
data['posts'] = this.posts;
data['user'] = this.user;
data['following'] = this.following;
data['friends'] = this.friends;
data['relation'] = this.relation;
return data;
}
@override
String toString() {
return '{"posts": "$posts", "user": "$user","relation":"$relation","friends":"$friends","following":"$following"}';
}
}