fromJson static method
Implementation
static Session? fromJson(Map<String, dynamic>? json) {
if (json == null) {
return null;
}
return Session(
id: int.tryParse((json['id'] as dynamic)?.toString() ?? '') ?? 0,
isCurrent: (json['is_current'] as bool?) ?? false,
isPasswordPending: (json['is_password_pending'] as bool?) ?? false,
isUnconfirmed: (json['is_unconfirmed'] as bool?) ?? false,
canAcceptSecretChats: (json['can_accept_secret_chats'] as bool?) ?? false,
canAcceptCalls: (json['can_accept_calls'] as bool?) ?? false,
deviceType: SessionDeviceType.fromJson(
tdMapFromJson(json['device_type']),
),
apiId: (json['api_id'] as int?) ?? 0,
applicationName: (json['application_name'] as String?) ?? '',
applicationVersion: (json['application_version'] as String?) ?? '',
isOfficialApplication:
(json['is_official_application'] as bool?) ?? false,
deviceModel: (json['device_model'] as String?) ?? '',
platform: (json['platform'] as String?) ?? '',
systemVersion: (json['system_version'] as String?) ?? '',
logInDate: (json['log_in_date'] as int?) ?? 0,
lastActiveDate: (json['last_active_date'] as int?) ?? 0,
ipAddress: (json['ip_address'] as String?) ?? '',
location: (json['location'] as String?) ?? '',
);
}