AccessToken.fromJson constructor
convert the data provided for the platform channel to one instance of AccessToken
json
data returned by the platform channel
Implementation
factory AccessToken.fromJson(Map<String, dynamic> json) {
return AccessToken(
userId: json['userId'],
token: json['token'],
expires: DateTime.fromMillisecondsSinceEpoch(
json['expires'].clamp(
minMillisecondsSinceEpoch,
maxMillisecondsSinceEpoch,
),
),
lastRefresh: DateTime.fromMillisecondsSinceEpoch(json['lastRefresh']),
applicationId: json['applicationId'],
graphDomain: json['graphDomain'],
isExpired: json['isExpired'],
declinedPermissions: json['declinedPermissions'] != null
? List<String>.from(json['declinedPermissions'])
: null,
grantedPermissions: json['grantedPermissions'] != null
? List<String>.from(json['grantedPermissions'])
: null,
);
}