CreateRequest.fromJson constructor

CreateRequest.fromJson(
  1. Object? json
)

Implementation

factory CreateRequest.fromJson(Object? json) {
  try {
    return NewCustomerCreateRequest(
      CreateNewCustomerInput.fromJson(
        (json as Map).cast<String, Object?>(),
      ),
    );
  } catch (_) {}
  try {
    return ExistingCustomerCreateRequest(
      CreateExistingCustomerInput.fromJson(
        (json as Map).cast<String, Object?>(),
      ),
    );
  } catch (_) {}
  throw FormatException('Unsupported CreateRequest value');
}