SimulateTransactionResponse.fromJson constructor Null safety

SimulateTransactionResponse.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory SimulateTransactionResponse.fromJson(Map<String, dynamic> json) {
  SimulateTransactionResponse response = SimulateTransactionResponse(json);
  if (json['result'] != null) {
    response.resultError = json['result']['error'];
    if (json['result']['results'] != null) {
      response.results = List<TransactionStatusResult>.from(json['result']
              ['results']
          .map((e) => TransactionStatusResult.fromJson(e)));
    }
    String? footStr = json['result']['footprint'];
    if (footStr != null && footStr.trim() != "") {
      response.footprint =
          Footprint(XdrLedgerFootprint.fromBase64EncodedXdrString(footStr));
    }
    response.latestLedger = json['result']['latestLedger'];
    if (json['result']['cost'] != null) {
      response.cost = Cost.fromJson(json['result']['cost']);
    }
  } else if (json['error'] != null) {
    response.error = SorobanRpcErrorResponse.fromJson(json);
  }
  return response;
}