deserialize<T> method
Deserialize the provided json data to an object of type t or T.
Implementation
@override
T deserialize<T>(
dynamic data, [
Type? t,
]) {
t ??= T;
final dataClassName = getClassNameFromObjectJson(data);
if (dataClassName != null && dataClassName != getClassNameForType(t)) {
try {
return deserializeByClassName({
'className': dataClassName,
'data': data,
});
} on FormatException catch (_) {
// If the className is not recognized (e.g., older client receiving
// data with a new subtype), fall back to deserializing without the
// className, using the expected type T.
}
}
if (t == _i3.RevokedAuthenticationAuthId) {
return _i3.RevokedAuthenticationAuthId.fromJson(data) as T;
}
if (t == _i4.RevokedAuthenticationScope) {
return _i4.RevokedAuthenticationScope.fromJson(data) as T;
}
if (t == _i5.RevokedAuthenticationUser) {
return _i5.RevokedAuthenticationUser.fromJson(data) as T;
}
if (t == _i6.CacheInfo) {
return _i6.CacheInfo.fromJson(data) as T;
}
if (t == _i7.CachesInfo) {
return _i7.CachesInfo.fromJson(data) as T;
}
if (t == _i8.CloudStorageEntry) {
return _i8.CloudStorageEntry.fromJson(data) as T;
}
if (t == _i9.CloudStorageDirectUploadEntry) {
return _i9.CloudStorageDirectUploadEntry.fromJson(data) as T;
}
if (t == _i10.ClusterInfo) {
return _i10.ClusterInfo.fromJson(data) as T;
}
if (t == _i11.ClusterServerInfo) {
return _i11.ClusterServerInfo.fromJson(data) as T;
}
if (t == _i12.DatabaseMigrationVersion) {
return _i12.DatabaseMigrationVersion.fromJson(data) as T;
}
if (t == _i13.DistributedCacheEntry) {
return _i13.DistributedCacheEntry.fromJson(data) as T;
}
if (t == _i14.AccessDeniedException) {
return _i14.AccessDeniedException.fromJson(data) as T;
}
if (t == _i15.FileNotFoundException) {
return _i15.FileNotFoundException.fromJson(data) as T;
}
if (t == _i16.FutureCallClaimEntry) {
return _i16.FutureCallClaimEntry.fromJson(data) as T;
}
if (t == _i17.FutureCallEntry) {
return _i17.FutureCallEntry.fromJson(data) as T;
}
if (t == _i18.LogEntry) {
return _i18.LogEntry.fromJson(data) as T;
}
if (t == _i19.LogLevel) {
return _i19.LogLevel.fromJson(data) as T;
}
if (t == _i20.LogResult) {
return _i20.LogResult.fromJson(data) as T;
}
if (t == _i21.LogSettings) {
return _i21.LogSettings.fromJson(data) as T;
}
if (t == _i22.LogSettingsOverride) {
return _i22.LogSettingsOverride.fromJson(data) as T;
}
if (t == _i23.MessageLogEntry) {
return _i23.MessageLogEntry.fromJson(data) as T;
}
if (t == _i24.MethodInfo) {
return _i24.MethodInfo.fromJson(data) as T;
}
if (t == _i25.QueryLogEntry) {
return _i25.QueryLogEntry.fromJson(data) as T;
}
if (t == _i26.ReadWriteTestEntry) {
return _i26.ReadWriteTestEntry.fromJson(data) as T;
}
if (t == _i27.RuntimeSettings) {
return _i27.RuntimeSettings.fromJson(data) as T;
}
if (t == _i28.ServerHealthConnectionInfo) {
return _i28.ServerHealthConnectionInfo.fromJson(data) as T;
}
if (t == _i29.ServerHealthMetric) {
return _i29.ServerHealthMetric.fromJson(data) as T;
}
if (t == _i30.ServerHealthResult) {
return _i30.ServerHealthResult.fromJson(data) as T;
}
if (t == _i31.ServerpodSqlException) {
return _i31.ServerpodSqlException.fromJson(data) as T;
}
if (t == _i32.SessionLogEntry) {
return _i32.SessionLogEntry.fromJson(data) as T;
}
if (t == _i33.SessionLogFilter) {
return _i33.SessionLogFilter.fromJson(data) as T;
}
if (t == _i34.SessionLogInfo) {
return _i34.SessionLogInfo.fromJson(data) as T;
}
if (t == _i35.SessionLogResult) {
return _i35.SessionLogResult.fromJson(data) as T;
}
if (t == _i1.getType<_i3.RevokedAuthenticationAuthId?>()) {
return (data != null
? _i3.RevokedAuthenticationAuthId.fromJson(data)
: null)
as T;
}
if (t == _i1.getType<_i4.RevokedAuthenticationScope?>()) {
return (data != null
? _i4.RevokedAuthenticationScope.fromJson(data)
: null)
as T;
}
if (t == _i1.getType<_i5.RevokedAuthenticationUser?>()) {
return (data != null
? _i5.RevokedAuthenticationUser.fromJson(data)
: null)
as T;
}
if (t == _i1.getType<_i6.CacheInfo?>()) {
return (data != null ? _i6.CacheInfo.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i7.CachesInfo?>()) {
return (data != null ? _i7.CachesInfo.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i8.CloudStorageEntry?>()) {
return (data != null ? _i8.CloudStorageEntry.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i9.CloudStorageDirectUploadEntry?>()) {
return (data != null
? _i9.CloudStorageDirectUploadEntry.fromJson(data)
: null)
as T;
}
if (t == _i1.getType<_i10.ClusterInfo?>()) {
return (data != null ? _i10.ClusterInfo.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i11.ClusterServerInfo?>()) {
return (data != null ? _i11.ClusterServerInfo.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i12.DatabaseMigrationVersion?>()) {
return (data != null
? _i12.DatabaseMigrationVersion.fromJson(data)
: null)
as T;
}
if (t == _i1.getType<_i13.DistributedCacheEntry?>()) {
return (data != null ? _i13.DistributedCacheEntry.fromJson(data) : null)
as T;
}
if (t == _i1.getType<_i14.AccessDeniedException?>()) {
return (data != null ? _i14.AccessDeniedException.fromJson(data) : null)
as T;
}
if (t == _i1.getType<_i15.FileNotFoundException?>()) {
return (data != null ? _i15.FileNotFoundException.fromJson(data) : null)
as T;
}
if (t == _i1.getType<_i16.FutureCallClaimEntry?>()) {
return (data != null ? _i16.FutureCallClaimEntry.fromJson(data) : null)
as T;
}
if (t == _i1.getType<_i17.FutureCallEntry?>()) {
return (data != null ? _i17.FutureCallEntry.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i18.LogEntry?>()) {
return (data != null ? _i18.LogEntry.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i19.LogLevel?>()) {
return (data != null ? _i19.LogLevel.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i20.LogResult?>()) {
return (data != null ? _i20.LogResult.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i21.LogSettings?>()) {
return (data != null ? _i21.LogSettings.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i22.LogSettingsOverride?>()) {
return (data != null ? _i22.LogSettingsOverride.fromJson(data) : null)
as T;
}
if (t == _i1.getType<_i23.MessageLogEntry?>()) {
return (data != null ? _i23.MessageLogEntry.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i24.MethodInfo?>()) {
return (data != null ? _i24.MethodInfo.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i25.QueryLogEntry?>()) {
return (data != null ? _i25.QueryLogEntry.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i26.ReadWriteTestEntry?>()) {
return (data != null ? _i26.ReadWriteTestEntry.fromJson(data) : null)
as T;
}
if (t == _i1.getType<_i27.RuntimeSettings?>()) {
return (data != null ? _i27.RuntimeSettings.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i28.ServerHealthConnectionInfo?>()) {
return (data != null
? _i28.ServerHealthConnectionInfo.fromJson(data)
: null)
as T;
}
if (t == _i1.getType<_i29.ServerHealthMetric?>()) {
return (data != null ? _i29.ServerHealthMetric.fromJson(data) : null)
as T;
}
if (t == _i1.getType<_i30.ServerHealthResult?>()) {
return (data != null ? _i30.ServerHealthResult.fromJson(data) : null)
as T;
}
if (t == _i1.getType<_i31.ServerpodSqlException?>()) {
return (data != null ? _i31.ServerpodSqlException.fromJson(data) : null)
as T;
}
if (t == _i1.getType<_i32.SessionLogEntry?>()) {
return (data != null ? _i32.SessionLogEntry.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i33.SessionLogFilter?>()) {
return (data != null ? _i33.SessionLogFilter.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i34.SessionLogInfo?>()) {
return (data != null ? _i34.SessionLogInfo.fromJson(data) : null) as T;
}
if (t == _i1.getType<_i35.SessionLogResult?>()) {
return (data != null ? _i35.SessionLogResult.fromJson(data) : null) as T;
}
if (t == List<String>) {
return (data as List).map((e) => deserialize<String>(e)).toList() as T;
}
if (t == _i1.getType<List<String>?>()) {
return (data != null
? (data as List).map((e) => deserialize<String>(e)).toList()
: null)
as T;
}
if (t == List<_i11.ClusterServerInfo>) {
return (data as List)
.map((e) => deserialize<_i11.ClusterServerInfo>(e))
.toList()
as T;
}
if (t == List<_i18.LogEntry>) {
return (data as List).map((e) => deserialize<_i18.LogEntry>(e)).toList()
as T;
}
if (t == List<_i22.LogSettingsOverride>) {
return (data as List)
.map((e) => deserialize<_i22.LogSettingsOverride>(e))
.toList()
as T;
}
if (t == List<_i29.ServerHealthMetric>) {
return (data as List)
.map((e) => deserialize<_i29.ServerHealthMetric>(e))
.toList()
as T;
}
if (t == List<_i28.ServerHealthConnectionInfo>) {
return (data as List)
.map((e) => deserialize<_i28.ServerHealthConnectionInfo>(e))
.toList()
as T;
}
if (t == List<_i25.QueryLogEntry>) {
return (data as List)
.map((e) => deserialize<_i25.QueryLogEntry>(e))
.toList()
as T;
}
if (t == List<_i23.MessageLogEntry>) {
return (data as List)
.map((e) => deserialize<_i23.MessageLogEntry>(e))
.toList()
as T;
}
if (t == List<_i34.SessionLogInfo>) {
return (data as List)
.map((e) => deserialize<_i34.SessionLogInfo>(e))
.toList()
as T;
}
if (t == List<_i36.TableDefinition>) {
return (data as List)
.map((e) => deserialize<_i36.TableDefinition>(e))
.toList()
as T;
}
if (t == List<String>) {
return (data as List).map((e) => deserialize<String>(e)).toList() as T;
}
try {
return _i37.Protocol().deserialize<T>(data, t);
} on _i1.DeserializationTypeNotFoundException catch (_) {}
return super.deserialize<T>(data, t);
}