fromJSON<E extends Identifiable<String>> static method

EntitySubscriptionEvent<E> fromJSON<E extends Identifiable<String>>(
  1. Map<String, dynamic> data,
  2. E entityFromJson(
    1. Map<String, dynamic> data
    )
)

Implementation

static EntitySubscriptionEvent<E> fromJSON<E extends Identifiable<String>>(Map<String, dynamic> data, E Function(Map<String, dynamic> data) entityFromJson) {
	if (data["kotlinType"] == null) {
		throw ArgumentError('Missing discriminator: kotlinType');
	}
	String discriminator = data["kotlinType"];
	switch (discriminator) {
		case "com.icure.cardinal.sdk.subscription.EntitySubscriptionEvent.Connected":
			return Connected.fromJSON(data);
		case "com.icure.cardinal.sdk.subscription.EntitySubscriptionEvent.Reconnected":
			return Reconnected.fromJSON(data);
		case "com.icure.cardinal.sdk.subscription.EntitySubscriptionEvent.UnexpectedError":
			return UnexpectedError.fromJSON(data);
		case "com.icure.cardinal.sdk.subscription.EntitySubscriptionEvent.ConnectionError.MissedPing":
			return MissedPing.fromJSON(data);
		case "com.icure.cardinal.sdk.subscription.EntitySubscriptionEvent.ConnectionError.ClosedByServer":
			return ClosedByServer.fromJSON(data);
		case "com.icure.cardinal.sdk.subscription.EntitySubscriptionEvent.EntityNotification":
			return EntityNotification.fromJSON(data, entityFromJson);
		case "com.icure.cardinal.sdk.subscription.EntitySubscriptionEvent.EntityError.DeserializationError":
			return DeserializationError.fromJSON(data);
		default:
			throw ArgumentError('Invalid subclass $discriminator');
	}
}