ConnectToken.fromJson constructor
ConnectToken.fromJson(
- Map<String, dynamic> json
)
Implementation
factory ConnectToken.fromJson(Map<String, dynamic> json) => ConnectToken(
expiresAt: (json['ExpiresAt'] as num?)?.toInt() ?? 0,
contextType: ContextType.fromValue((json['ContextType'] as num?)?.toInt() ?? 0),
userType: UserType.fromValue((json['UserType'] as num?)?.toInt() ?? 0),
isInternal: (json['IsInternal'] as bool?) ?? false,
userId: (json['UserId'] as String?) ?? '',
authSessionId: (json['AuthSessionId'] as String?) ?? '',
isAnonymous: (json['IsAnonymous'] as bool?) ?? false,
isGlobal: (json['IsGlobal'] as bool?) ?? false,
opcodeGroupsFromServer: Opcode.fromValue((json['OpcodeGroupsFromServer'] as num?)?.toInt() ?? 0),
opcodeGroupsToServer: Opcode.fromValue((json['OpcodeGroupsToServer'] as num?)?.toInt() ?? 0),
parameters: (json['Parameters'] as Map<String, dynamic>?)?.map((k, v) => MapEntry(k, (v as String?) ?? '')) ?? const {},
serverSessionId: (json['ServerSessionId'] as String?) ?? '',
description: (json['Description'] as String?) ?? '',
deviceId: (json['DeviceId'] as String?) ?? '',
productId: (json['ProductId'] as String?) ?? '',
versionId: (json['VersionId'] as String?) ?? '',
installId: (json['InstallId'] as String?) ?? '',
locale: (json['Locale'] as String?) ?? '',
userAgent: (json['UserAgent'] as String?) ?? '',
clientType: ClientType.fromValue((json['ClientType'] as num?)?.toInt() ?? 0),
sdkType: SdkType.fromValue((json['SdkType'] as num?)?.toInt() ?? 0),
sdkCapability: (json['SdkCapability'] as num?)?.toInt() ?? 0,
protocolVersion: (json['ProtocolVersion'] as num?)?.toInt() ?? 0,
payloadType: PayloadType.fromValue((json['PayloadType'] as num?)?.toInt() ?? 0),
styleFormat: StyleFormat.fromValue((json['StyleFormat'] as num?)?.toInt() ?? 0),
supportsCompression: (json['SupportsCompression'] as bool?) ?? false,
hasInput: (json['HasInput'] as bool?) ?? false,
receiveAllMessages: (json['ReceiveAllMessages'] as bool?) ?? false,
viewportWidth: (json['ViewportWidth'] as num?)?.toInt() ?? 0,
viewportHeight: (json['ViewportHeight'] as num?)?.toInt() ?? 0,
theme: (json['Theme'] as String?) ?? '',
timezone: (json['Timezone'] as String?) ?? '',
isTouchDevice: (json['IsTouchDevice'] as bool?) ?? false,
initialPath: (json['InitialPath'] as String?) ?? '',
initialUrl: (json['InitialUrl'] as String?) ?? '',
isSnapshot: (json['IsSnapshot'] as bool?) ?? false,
snapshotVariant: (json['SnapshotVariant'] as String?) ?? '',
);