CoinMarketData.fromJson constructor
Constructs a CoinMarketData instance from a JSON object.
json
is a map containing the key-value pairs of the data.
Implementation
CoinMarketData.fromJson(Map<String, dynamic> json)
: this.dataByCurrency = Helpers.parseMarketData(json),
this.totalValueLocked = Convert.toDoubleN(json['total_value_locked']),
this.mcapToTvlRatio = Convert.toDoubleN(json['mcap_to_tvl_ratio']),
this.fdvToTvlRatio = Convert.toDoubleN(json['fdv_to_tvl_ratio']),
this.roi = Convert.toDoubleN(json['roi']),
this.priceChange24h = Convert.toDoubleN(json['price_change_24h']),
this.priceChangePercentage24h =
Convert.toDoubleN(json['price_change_percentage_24h']),
this.priceChangePercentage7d =
Convert.toDoubleN(json['price_change_percentage_7d']),
this.priceChangePercentage14d =
Convert.toDoubleN(json['price_change_percentage_14d']),
this.priceChangePercentage30d =
Convert.toDoubleN(json['price_change_percentage_30d']),
this.priceChangePercentage60d =
Convert.toDoubleN(json['price_change_percentage_60d']),
this.priceChangePercentage200d =
Convert.toDoubleN(json['price_change_percentage_200d']),
this.priceChangePercentage1y =
Convert.toDoubleN(json['price_change_percentage_1y']),
this.marketCapChange24h =
Convert.toDoubleN(json['market_cap_change_24h']),
this.marketCapChangePercentage24h =
Convert.toDoubleN(json['market_cap_change_percentage_24h']),
this.totalSupply = Convert.toDoubleN(json['total_supply']),
this.maxSupply = Convert.toDoubleN(json['max_supply']),
this.circulatingSupply = Convert.toDoubleN(json['circulating_supply']),
this.sparkline7d = json.containsKey('sparkline_7d')
? MarketSparkline.fromJson(json['sparkline_7d'])
: null,
this.lastUpdated = Convert.toDateTimeN(json['last_updated']);