SendRequestRecipient.fromJson constructor

SendRequestRecipient.fromJson(
  1. Object? json
)

Implementation

factory SendRequestRecipient.fromJson(Object? json) {
  try {
    return SendPhoneRecipient(
      PhoneRecipientInput.fromJson(
        (json as Map).cast<String, Object?>(),
      ),
    );
  } catch (_) {}
  try {
    return SendEmailRecipient(
      EmailRecipientInput.fromJson(
        (json as Map).cast<String, Object?>(),
      ),
    );
  } catch (_) {}
  try {
    return SendSavedCustomerRecipient(
      SavedCustomerRecipientInput.fromJson(
        (json as Map).cast<String, Object?>(),
      ),
    );
  } catch (_) {}
  throw FormatException('Unsupported SendRequestRecipient value');
}