MarketData.fromJson constructor

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

Implementation

factory MarketData.fromJson(Map<String, dynamic> json) => MarketData(
      currentPrice: Map.from(json["current_price"])
          .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      roi: json["roi"],
      ath: Map.from(json["ath"])
          .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      athChangePercentage: Map.from(json["ath_change_percentage"])
          .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      athDate: Map.from(json["ath_date"])
          .map((k, v) => MapEntry<String, DateTime>(k, DateTime.parse(v))),
      atl: Map.from(json["atl"])
          .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      atlChangePercentage: Map.from(json["atl_change_percentage"])
          .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      atlDate: Map.from(json["atl_date"])
          .map((k, v) => MapEntry<String, DateTime>(k, DateTime.parse(v))),
      marketCap: Map.from(json["market_cap"])
          .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      marketCapRank: json["market_cap_rank"],
      fullyDilutedValuation:
          FullyDilutedValuation.fromJson(json["fully_diluted_valuation"]),
      totalVolume: Map.from(json["total_volume"])
          .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      high24H: Map.from(json["high_24h"])
          .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      low24H: Map.from(json["low_24h"])
          .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      priceChange24H: json["price_change_24h"].toDouble(),
      priceChangePercentage24H:
          json["price_change_percentage_24h"].toDouble(),
      priceChangePercentage7D: json["price_change_percentage_7d"].toDouble(),
      priceChangePercentage14D:
          json["price_change_percentage_14d"].toDouble(),
      priceChangePercentage30D:
          json["price_change_percentage_30d"].toDouble(),
      priceChangePercentage60D:
          json["price_change_percentage_60d"].toDouble(),
      priceChangePercentage200D:
          json["price_change_percentage_200d"].toDouble(),
      priceChangePercentage1Y: json["price_change_percentage_1y"].toDouble(),
      marketCapChange24H: json["market_cap_change_24h"].toDouble(),
      marketCapChangePercentage24H:
          json["market_cap_change_percentage_24h"].toDouble(),
      priceChange24HInCurrency: Map.from(json["price_change_24h_in_currency"])
          .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      priceChangePercentage1HInCurrency:
          Map.from(json["price_change_percentage_1h_in_currency"])
              .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      priceChangePercentage24HInCurrency:
          Map.from(json["price_change_percentage_24h_in_currency"])
              .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      priceChangePercentage7DInCurrency:
          Map.from(json["price_change_percentage_7d_in_currency"])
              .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      priceChangePercentage14DInCurrency:
          Map.from(json["price_change_percentage_14d_in_currency"])
              .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      priceChangePercentage30DInCurrency:
          Map.from(json["price_change_percentage_30d_in_currency"])
              .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      priceChangePercentage60DInCurrency:
          Map.from(json["price_change_percentage_60d_in_currency"])
              .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      priceChangePercentage200DInCurrency:
          Map.from(json["price_change_percentage_200d_in_currency"])
              .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      priceChangePercentage1YInCurrency: FullyDilutedValuation.fromJson(
          json["price_change_percentage_1y_in_currency"]),
      marketCapChange24HInCurrency:
          Map.from(json["market_cap_change_24h_in_currency"])
              .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      marketCapChangePercentage24HInCurrency:
          Map.from(json["market_cap_change_percentage_24h_in_currency"])
              .map((k, v) => MapEntry<String, double>(k, v.toDouble())),
      totalSupply: json["total_supply"],
      maxSupply: json["max_supply"],
      circulatingSupply: json["circulating_supply"].toDouble(),
      lastUpdated: DateTime.parse(json["last_updated"]),
    );