Coin.fromJson constructor
Constructs a Coin object from JSON data.
json
- The JSON data to parse.
Implementation
Coin.fromJson(Map<String, dynamic> json)
: this.id = Convert.toStr(json['id'], ''),
this.symbol = Convert.toStr(json['symbol'], ''),
this.name = Convert.toStr(json['name'], ''),
this.assetPlatformId = Convert.toStrN(json['asset_platform_id']),
this.platforms = Convert.toMapOfStringStringN(json['platforms']),
this.blockTimeInMinutes =
Convert.toDouble(json['block_time_in_minutes'], 0),
this.hashingAlgorithm = Convert.toStr(json['hashing_algorithm'], ''),
this.categories = Convert.toListOfString(json['categories']),
this.publicNotice = Convert.toStr(json['public_notice'], ''),
this.additionalNotices =
Convert.toListOfString(json['additional_notices']),
this.localization = json.containsKey('localization')
? LocalizedString.fromJson(json['localization'])
: null,
this.description = json.containsKey('description')
? LocalizedString.fromJson(json['description'])
: null,
this.links = json.containsKey('links')
? CoinLinks.fromJson(json['links'])
: null,
this.image = json.containsKey('image')
? ImageInfo.fromJson(json['image'])
: null,
this.countryOrigin = Convert.toStrN(json['country_origin']),
this.genesisDate = Convert.toDateTimeN(json['genesis_date']),
this.contractAddress = Convert.toStrN(json['contract_address']),
this.sentimentVotesUpPercentage =
Convert.toDoubleN(json['sentiment_votes_up_percentage']),
this.sentimentVotesDownPercentage =
Convert.toDoubleN(json['sentiment_votes_down_percentage']),
this.marketCapRank = Convert.toIntN(json['market_cap_rank']),
this.coingeckoRank = Convert.toIntN(json['coingecko_rank']),
this.coingeckoScore = Convert.toDoubleN(json['coingecko_score']),
this.developerScore = Convert.toDoubleN(json['developer_score']),
this.communityScore = Convert.toDoubleN(json['community_score']),
this.liquidityScore = Convert.toDoubleN(json['liquidity_score']),
this.publicInterestScore =
Convert.toDoubleN(json['public_interest_score']),
this.marketData = json.containsKey('market_data')
? CoinMarketData.fromJson(json['market_data'])
: null,
this.communityData = json.containsKey('community_data')
? CoinCommunityData.fromJson(json['community_data'])
: null,
this.developerData = json.containsKey('developer_data')
? CoinDeveloperData.fromJson(json['developer_data'])
: null,
this.publicInterestStats = json.containsKey('public_interest_stats')
? CoinPublicInterestsStats.fromJson(json['public_interest_stats'])
: null,
this.statusUpdates = _parseStatusUpdates(json['status_updates']),
this.lastUpdated = Convert.toDateTimeN(json['last_updated']),
this.tickers = _parseTickers(json['tickers']);