Context.fromJson constructor
Context.fromJson(
- Map<String, dynamic> json
)
Implementation
factory Context.fromJson(Map<String, dynamic> json) => Context(
contextType: ContextType.fromValue((json['ContextType'] as num?)?.toInt() ?? 0),
userType: UserType.fromValue((json['UserType'] as num?)?.toInt() ?? 0),
payloadType: PayloadType.fromValue((json['PayloadType'] as num?)?.toInt() ?? 0),
description: (json['Description'] as String?) ?? '',
userId: (json['UserId'] 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?) ?? '',
sessionId: (json['SessionId'] as num?)?.toInt() ?? 0,
isInternal: (json['IsInternal'] as bool?) ?? false,
isSnapshot: (json['IsSnapshot'] as bool?) ?? false,
isReady: (json['IsReady'] as bool?) ?? false,
hasInput: (json['HasInput'] as bool?) ?? false,
channelLocale: (json['ChannelLocale'] as String?) ?? '',
embeddedSpaceId: (json['EmbeddedSpaceId'] as String?) ?? '',
authSessionId: (json['AuthSessionId'] as String?) ?? '',
receiveAllMessages: (json['ReceiveAllMessages'] as bool?) ?? false,
preciseJoinedAt: (json['PreciseJoinedAt'] as num?)?.toInt() ?? 0,
userAgent: (json['UserAgent'] as String?) ?? '',
clientType: ClientType.fromValue((json['ClientType'] as num?)?.toInt() ?? 0),
uniqueSessionId: (json['UniqueSessionId'] as String?) ?? '',
parameters: (json['Parameters'] as Map<String, dynamic>?)?.map((k, v) => MapEntry(k, (v as String?) ?? '')) ?? const {},
sdkType: SdkType.fromValue((json['SdkType'] as num?)?.toInt() ?? 0),
sdkCapability: (json['SdkCapability'] as num?)?.toInt() ?? 0,
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?) ?? '',
styleFormat: StyleFormat.fromValue((json['StyleFormat'] as num?)?.toInt() ?? 0),
supportsCompression: (json['SupportsCompression'] as bool?) ?? false,
isSoftDisconnected: (json['IsSoftDisconnected'] as bool?) ?? false,
softDisconnectAt: (json['SoftDisconnectAt'] as num?)?.toInt() ?? 0,
);