tryDeserialize static method
Implementation
static ChannelUpdateRequest tryDeserialize(
Map<String, dynamic> json, {
String key = 'type',
Map<Type, Object?>? mapping,
}) {
final mappingFallback = const <Type, Object?>{
ChannelUpdateRequest0: '0',
ChannelUpdateRequest2: '2',
ChannelUpdateRequest4: '4',
ChannelUpdateRequest998: '998',
ChannelUpdateRequest3: '3',
};
final value = json[key];
final effective = mapping ?? mappingFallback;
return switch (value) {
_ when value == effective[ChannelUpdateRequest0] =>
ChannelUpdateRequest0.fromJson(json),
_ when value == effective[ChannelUpdateRequest2] =>
ChannelUpdateRequest2.fromJson(json),
_ when value == effective[ChannelUpdateRequest4] =>
ChannelUpdateRequest4.fromJson(json),
_ when value == effective[ChannelUpdateRequest998] =>
ChannelUpdateRequest998.fromJson(json),
_ when value == effective[ChannelUpdateRequest3] =>
ChannelUpdateRequest3.fromJson(json),
_ => throw FormatException(
'Unknown discriminator value "${json[key]}" for ChannelUpdateRequest',
),
};
}