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