UserAccounts.fromJson constructor
UserAccounts.fromJson(
- Map<String, dynamic> json
)
Implementation
factory UserAccounts.fromJson(Map<String, dynamic> json) {
return UserAccounts(
user: User.fromJson(json['user']).obs,
sessionTOKEN: Rx(json['sessionTOKEN']),
language: Rxn(json['language']),
widgetPosts: (json['widgetPosts'] as List<dynamic>?)
?.map((post) => Post.fromJson(post))
.toList(),
widgetStoriescard: (json['widgetStoriescard'] as List<dynamic>?)
?.map((story) => StoryList.fromJson(story))
.toList(),
lastsharingpost: (json['lastsharingpost'] as List<dynamic>?)
?.map((post) => Post.fromJson(post))
.toList(),
gallery: (json['gallery'] as List<dynamic>?)
?.map((post) => Media.fromJson(post))
.toList(),
xpcard: (json['xpcard'] as List<dynamic>?)
?.map((post) => APIPlayerPop.fromJson(post))
.toList(),
popcard: (json['popcard'] as List<dynamic>?)
?.map((post) => APIPlayerPop.fromJson(post))
.toList(),
chatList: json['chatList'] == null
? null
: (json['chatList'] as List<dynamic>?)
?.map((chatList) => Chat.fromJson(chatList))
.toList(),
newchatList: json['newchatList'] == null
? null
: (json['newchatList'] as List<dynamic>?)
?.map((newchatList) => Chat.fromJson(newchatList))
.toList(),
newsList: (json['newsList'] as List<dynamic>?)
?.map((news) => News.fromJson(news))
.toList(),
searchList: (json['searchList'] as List<dynamic>?)
?.map((user) => User.fromJson(user))
.toList(),
notificationList: (json['notificationList'] as List<dynamic>?)
?.map((user) => Notifications.fromJson(user))
.toList(),
lastviewusersList: (json['lastviewusersList'] as List<dynamic>?)
?.map((user) => User.fromJson(user))
.toList(),
lastviewgroupsList: (json['lastviewgroupsList'] as List<dynamic>?)
?.map((group) => Group.fromJson(group))
.toList(),
lastviewschoolsList: (json['lastviewschoolsList'] as List<dynamic>?)
?.map((school) => School.fromJson(school))
.toList(),
lastviewstationsList: (json['lastviewstationsList'] as List<dynamic>?)
?.map((station) => Station.fromJson(station))
.toList(),
chatNotificationCount: Rx<int>(json['chatNotificationCount']),
surveyNotificationCount: Rx<int>(json['surveyNotificationCount']),
eventsNotificationCount: Rx<int>(json['eventsNotificationCount']),
downloadableCount: Rx<int>(json['downloadableCount']),
friendRequestCount: Rx<int>(json['friendRequestCount']),
groupInviteCount: Rx<int>(json['groupInviteCount']),
favoriteteams: (json['favoriteteams'] as List<dynamic>?)
?.map((team) => Team.fromJson(team))
.toList() ??
[],
favTeam: json['favTeam'] ?? {},
favteamRequest: json['favteamRequest'] ?? false,
);
}