InfoResponse.fromJson constructor

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

Implementation

factory InfoResponse.fromJson(Map<String, dynamic> json) {
  Map<String, dynamic> depositDynamic = json['deposit'] == null
      ? null
      : json['deposit'] as Map<String, dynamic>;

  Map<String, DepositAsset> depositMap = {};
  if (depositDynamic != null) {
    depositDynamic.forEach((key, value) {
      depositMap[key] =
          new DepositAsset.fromJson(value as Map<String, dynamic>);
    });
  }
  Map<String, dynamic> withdrawDynamic = json['withdraw'] == null
      ? null
      : json['withdraw'] as Map<String, dynamic>;

  Map<String, WithdrawAsset> withdrawMap = {};
  if (withdrawDynamic != null) {
    withdrawDynamic.forEach((key, value) {
      withdrawMap[key] =
          new WithdrawAsset.fromJson(value as Map<String, dynamic>);
    });
  }

  return new InfoResponse(
      depositMap,
      withdrawMap,
      json['fee'] == null
          ? null
          : new AnchorFeeInfo.fromJson(json['fee'] as Map<String, dynamic>),
      json['transactions'] == null
          ? null
          : new AnchorTransactionsInfo.fromJson(
              json['transactions'] as Map<String, dynamic>),
      json['transaction'] == null
          ? null
          : new AnchorTransactionInfo.fromJson(
              json['transaction'] as Map<String, dynamic>));
}