fromJson method
Implementation
@override
USpaceNotifySpaceUpdateUpdate fromJson(Map<String, dynamic> json) {
if (RepoWrite.validate(json)) {
return USpaceNotifySpaceUpdateUpdate.repoWrite(
data: const RepoWriteConverter().fromJson(json),
);
}
if (RepoRemoved.validate(json)) {
return USpaceNotifySpaceUpdateUpdate.repoRemoved(
data: const RepoRemovedConverter().fromJson(json),
);
}
if (SpaceDeleted.validate(json)) {
return USpaceNotifySpaceUpdateUpdate.spaceDeleted(
data: const SpaceDeletedConverter().fromJson(json),
);
}
if (RegistrationExpired.validate(json)) {
return USpaceNotifySpaceUpdateUpdate.registrationExpired(
data: const RegistrationExpiredConverter().fromJson(json),
);
}
// No known `$type` matched: preserve the payload verbatim as an unknown
// variant. A payload whose `$type` *does* match a known ref but fails to
// convert is intentionally left to throw, so malformed data surfaces
// instead of being silently degraded to `.unknown`.
return USpaceNotifySpaceUpdateUpdate.unknown(data: json);
}