GlobalCoins.fromJson constructor

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

Implementation

factory GlobalCoins.fromJson(Map<String, dynamic> json) {
  json = json['data']??{};
  return GlobalCoins(
    activeCryptocurrencies: json['active_cryptocurrencies'] as int,
    upcomingIcos: json['upcoming_icos'] as int?,
    ongoingIcos: json['ongoing_icos'] as int?,
    endedIcos: json['ended_icos'] as int?,
    markets: json['markets'] as int?,
    totalMarketCap: json['total_market_cap'] == null
        ? null
        : json['total_market_cap'] as Map<String, dynamic>,
    totalVolume: json['total_volume'] == null
        ? null
        : (json['total_volume'] as Map<String, dynamic>),
    marketCapPercentage: json['market_cap_percentage'] == null
        ? null
        : (json['market_cap_percentage'] as Map<String, dynamic>),
    marketCapChangePercentage24hUsd:
        json['market_cap_change_percentage_24h_usd'] as double?,
    updatedAt: json['updated_at'] as int?,
  );
}