Skip to content

Instantly share code, notes, and snippets.

@alectogeek
Last active June 17, 2021 09:09
Show Gist options
  • Select an option

  • Save alectogeek/47c6eee88433dae40d1c77103356f71e to your computer and use it in GitHub Desktop.

Select an option

Save alectogeek/47c6eee88433dae40d1c77103356f71e to your computer and use it in GitHub Desktop.

Revisions

  1. alectogeek revised this gist Jun 17, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion main.dart
    Original file line number Diff line number Diff line change
    @@ -463,7 +463,7 @@ void main() {

    (currData['data']).forEach((dynamic item) {
    // Maybe you will need to cast to Map<String, dynamic>, but it works ok
    print(item['name'] + ' ' + item['quote']['price']);
    print(item['name'].toString() + ' ' + item['quote']['USD']['price'].toString());
    });


  2. alectogeek revised this gist Jun 17, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion main.dart
    Original file line number Diff line number Diff line change
    @@ -463,7 +463,7 @@ void main() {

    (currData['data']).forEach((dynamic item) {
    // Maybe you will need to cast to Map<String, dynamic>, but it works ok
    print(item['name']);
    print(item['name'] + ' ' + item['quote']['price']);
    });


  3. alectogeek renamed this gist Jun 17, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. alectogeek created this gist Jun 17, 2021.
    479 changes: 479 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,479 @@

    import 'dart:convert';

    void main() {
    String response = '''{
    "status": {
    "timestamp": "2021-06-17T05:09:56.181Z",
    "error_code": 0,
    "error_message": null,
    "elapsed": 13,
    "credit_count": 1,
    "notice": null,
    "total_count": 5306
    },
    "data": [
    {
    "id": 1,
    "name": "Bitcoin",
    "symbol": "BTC",
    "slug": "bitcoin",
    "num_market_pairs": 9085,
    "date_added": "2013-04-28T00:00:00.000Z",
    "tags": [
    "mineable",
    "pow",
    "sha-256",
    "store-of-value",
    "state-channels",
    "coinbase-ventures-portfolio",
    "three-arrows-capital-portfolio",
    "polychain-capital-portfolio",
    "binance-labs-portfolio",
    "arrington-xrp-capital",
    "blockchain-capital-portfolio",
    "boostvc-portfolio",
    "cms-holdings-portfolio",
    "dcg-portfolio",
    "dragonfly-capital-portfolio",
    "electric-capital-portfolio",
    "fabric-ventures-portfolio",
    "framework-ventures",
    "galaxy-digital-portfolio",
    "huobi-capital",
    "alameda-research-portfolio",
    "a16z-portfolio",
    "1confirmation-portfolio",
    "winklevoss-capital",
    "usv-portfolio",
    "placeholder-ventures-portfolio",
    "pantera-capital-portfolio",
    "multicoin-capital-portfolio",
    "paradigm-xzy-screener"
    ],
    "max_supply": 21000000,
    "circulating_supply": 18736793,
    "total_supply": 18736793,
    "platform": null,
    "cmc_rank": 1,
    "last_updated": "2021-06-17T05:09:02.000Z",
    "quote": {
    "USD": {
    "price": 38720.94448037543,
    "volume_24h": 40076887523.37981,
    "percent_change_1h": -0.82551281,
    "percent_change_24h": -3.91697069,
    "percent_change_7d": 4.98675986,
    "percent_change_30d": -14.6533295,
    "percent_change_60d": -31.70901628,
    "percent_change_90d": -33.43401226,
    "market_cap": 725506321493.287,
    "last_updated": "2021-06-17T05:09:02.000Z"
    }
    }
    },
    {
    "id": 1027,
    "name": "Ethereum",
    "symbol": "ETH",
    "slug": "ethereum",
    "num_market_pairs": 5798,
    "date_added": "2015-08-07T00:00:00.000Z",
    "tags": [
    "mineable",
    "pow",
    "smart-contracts",
    "ethereum",
    "coinbase-ventures-portfolio",
    "three-arrows-capital-portfolio",
    "polychain-capital-portfolio",
    "binance-labs-portfolio",
    "arrington-xrp-capital",
    "blockchain-capital-portfolio",
    "boostvc-portfolio",
    "cms-holdings-portfolio",
    "dcg-portfolio",
    "dragonfly-capital-portfolio",
    "electric-capital-portfolio",
    "fabric-ventures-portfolio",
    "framework-ventures",
    "hashkey-capital-portfolio",
    "kinetic-capital",
    "huobi-capital",
    "alameda-research-portfolio",
    "a16z-portfolio",
    "1confirmation-portfolio",
    "winklevoss-capital",
    "usv-portfolio",
    "placeholder-ventures-portfolio",
    "pantera-capital-portfolio",
    "multicoin-capital-portfolio",
    "paradigm-xzy-screener"
    ],
    "max_supply": null,
    "circulating_supply": 116322213.8115,
    "total_supply": 116322213.8115,
    "platform": null,
    "cmc_rank": 2,
    "last_updated": "2021-06-17T05:09:02.000Z",
    "quote": {
    "USD": {
    "price": 2416.708479871706,
    "volume_24h": 24217679399.797337,
    "percent_change_1h": -0.97606886,
    "percent_change_24h": -4.52854444,
    "percent_change_7d": -5.41282917,
    "percent_change_30d": -31.27620488,
    "percent_change_60d": 8.61882763,
    "percent_change_90d": 35.31739298,
    "market_cap": 281116880515.7017,
    "last_updated": "2021-06-17T05:09:02.000Z"
    }
    }
    },
    {
    "id": 825,
    "name": "Tether",
    "symbol": "USDT",
    "slug": "tether",
    "num_market_pairs": 12848,
    "date_added": "2015-02-25T00:00:00.000Z",
    "tags": [
    "payments",
    "stablecoin",
    "stablecoin-asset-backed",
    "solana-ecosystem"
    ],
    "max_supply": null,
    "circulating_supply": 62550846225.36169,
    "total_supply": 64471767616.826355,
    "platform": {
    "id": 1027,
    "name": "Ethereum",
    "symbol": "ETH",
    "slug": "ethereum",
    "token_address": "0xdac17f958d2ee523a2206206994597c13d831ec7"
    },
    "cmc_rank": 3,
    "last_updated": "2021-06-17T05:08:08.000Z",
    "quote": {
    "USD": {
    "price": 1.00049478707207,
    "volume_24h": 61416753647.76729,
    "percent_change_1h": 0.0138973,
    "percent_change_24h": 0.02636202,
    "percent_change_7d": -0.01399788,
    "percent_change_30d": 0.06233277,
    "percent_change_60d": -2.01292554,
    "percent_change_90d": -0.05819011,
    "market_cap": 62581795575.42103,
    "last_updated": "2021-06-17T05:08:08.000Z"
    }
    }
    },
    {
    "id": 1839,
    "name": "Binance Coin",
    "symbol": "BNB",
    "slug": "binance-coin",
    "num_market_pairs": 521,
    "date_added": "2017-07-25T00:00:00.000Z",
    "tags": [
    "marketplace",
    "centralized-exchange",
    "payments",
    "binance-smart-chain",
    "alameda-research-portfolio",
    "multicoin-capital-portfolio"
    ],
    "max_supply": 170532785,
    "circulating_supply": 153432897,
    "total_supply": 169432897,
    "platform": null,
    "cmc_rank": 4,
    "last_updated": "2021-06-17T05:09:07.000Z",
    "quote": {
    "USD": {
    "price": 355.8893955961221,
    "volume_24h": 1673253674.635253,
    "percent_change_1h": -1.12663573,
    "percent_change_24h": -2.27656686,
    "percent_change_7d": -2.93273968,
    "percent_change_30d": -32.74547029,
    "percent_change_60d": -25.26865956,
    "percent_change_90d": 33.40356433,
    "market_cap": 54605140977.89205,
    "last_updated": "2021-06-17T05:09:07.000Z"
    }
    }
    },
    {
    "id": 2010,
    "name": "Cardano",
    "symbol": "ADA",
    "slug": "cardano",
    "num_market_pairs": 255,
    "date_added": "2017-10-01T00:00:00.000Z",
    "tags": [
    "mineable",
    "dpos",
    "pos",
    "platform",
    "research",
    "smart-contracts",
    "staking",
    "binance-chain"
    ],
    "max_supply": 45000000000,
    "circulating_supply": 31946328269.464,
    "total_supply": 32704886184.416,
    "platform": null,
    "cmc_rank": 5,
    "last_updated": "2021-06-17T05:08:09.000Z",
    "quote": {
    "USD": {
    "price": 1.52769631744928,
    "volume_24h": 2139745968.8784823,
    "percent_change_1h": -0.69997467,
    "percent_change_24h": -1.89570042,
    "percent_change_7d": -3.85110634,
    "percent_change_30d": -27.89537364,
    "percent_change_60d": 25.51879351,
    "percent_change_90d": 23.8789033,
    "market_cap": 48804288053.28598,
    "last_updated": "2021-06-17T05:08:09.000Z"
    }
    }
    },
    {
    "id": 74,
    "name": "Dogecoin",
    "symbol": "DOGE",
    "slug": "dogecoin",
    "num_market_pairs": 363,
    "date_added": "2013-12-15T00:00:00.000Z",
    "tags": [
    "mineable",
    "pow",
    "scrypt",
    "medium-of-exchange",
    "memes",
    "payments"
    ],
    "max_supply": null,
    "circulating_supply": 130049782160.08418,
    "total_supply": 130049782160.08418,
    "platform": null,
    "cmc_rank": 6,
    "last_updated": "2021-06-17T05:09:03.000Z",
    "quote": {
    "USD": {
    "price": 0.31129848142273,
    "volume_24h": 1310816415.976706,
    "percent_change_1h": -0.66378502,
    "percent_change_24h": -1.91978139,
    "percent_change_7d": -7.83179818,
    "percent_change_30d": -37.52457669,
    "percent_change_60d": 14.55721474,
    "percent_change_90d": 441.36971821,
    "market_cap": 40484299695.791046,
    "last_updated": "2021-06-17T05:09:03.000Z"
    }
    }
    },
    {
    "id": 52,
    "name": "XRP",
    "symbol": "XRP",
    "slug": "xrp",
    "num_market_pairs": 639,
    "date_added": "2013-08-04T00:00:00.000Z",
    "tags": [
    "medium-of-exchange",
    "enterprise-solutions",
    "binance-chain",
    "arrington-xrp-capital",
    "galaxy-digital-portfolio",
    "a16z-portfolio",
    "pantera-capital-portfolio"
    ],
    "max_supply": 100000000000,
    "circulating_supply": 46205772880,
    "total_supply": 99990375595,
    "platform": null,
    "cmc_rank": 7,
    "last_updated": "2021-06-17T05:09:02.000Z",
    "quote": {
    "USD": {
    "price": 0.85461813137802,
    "volume_24h": 3018068911.244064,
    "percent_change_1h": -0.4167181,
    "percent_change_24h": -1.68121156,
    "percent_change_7d": -4.08781055,
    "percent_change_30d": -44.49298824,
    "percent_change_60d": -35.46315229,
    "percent_change_90d": 80.26978084,
    "market_cap": 39488291277.582794,
    "last_updated": "2021-06-17T05:09:02.000Z"
    }
    }
    },
    {
    "id": 3408,
    "name": "USD Coin",
    "symbol": "USDC",
    "slug": "usd-coin",
    "num_market_pairs": 833,
    "date_added": "2018-10-08T00:00:00.000Z",
    "tags": [
    "medium-of-exchange",
    "stablecoin",
    "stablecoin-asset-backed"
    ],
    "max_supply": null,
    "circulating_supply": 23925901200.161015,
    "total_supply": 23925901200.161015,
    "platform": {
    "id": 1027,
    "name": "Ethereum",
    "symbol": "ETH",
    "slug": "ethereum",
    "token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
    },
    "cmc_rank": 8,
    "last_updated": "2021-06-17T05:09:04.000Z",
    "quote": {
    "USD": {
    "price": 1.00037131332884,
    "volume_24h": 2193795281.472655,
    "percent_change_1h": 0.01232058,
    "percent_change_24h": 0.00490547,
    "percent_change_7d": 0.03213081,
    "percent_change_30d": 0.02901662,
    "percent_change_60d": -1.82176666,
    "percent_change_90d": -0.08666643,
    "market_cap": 23934785206.181145,
    "last_updated": "2021-06-17T05:09:04.000Z"
    }
    }
    },
    {
    "id": 6636,
    "name": "Polkadot",
    "symbol": "DOT",
    "slug": "polkadot-new",
    "num_market_pairs": 193,
    "date_added": "2020-08-19T00:00:00.000Z",
    "tags": [
    "substrate",
    "polkadot",
    "binance-chain",
    "polkadot-ecosystem",
    "three-arrows-capital-portfolio",
    "polychain-capital-portfolio",
    "blockchain-capital-portfolio",
    "boostvc-portfolio",
    "cms-holdings-portfolio",
    "coinfund-portfolio",
    "fabric-ventures-portfolio",
    "fenbushi-capital-portfolio",
    "hashkey-capital-portfolio",
    "kinetic-capital",
    "1confirmation-portfolio",
    "placeholder-ventures-portfolio",
    "pantera-capital-portfolio",
    "exnetwork-capital-portfolio"
    ],
    "max_supply": null,
    "circulating_supply": 952691264.49823,
    "total_supply": 1083415420.9234178,
    "platform": null,
    "cmc_rank": 9,
    "last_updated": "2021-06-17T05:09:06.000Z",
    "quote": {
    "USD": {
    "price": 23.58295964348006,
    "volume_24h": 1696935261.1608706,
    "percent_change_1h": -0.46148524,
    "percent_change_24h": -1.71782121,
    "percent_change_7d": -0.85267712,
    "percent_change_30d": -42.62090607,
    "percent_change_60d": -34.81962227,
    "percent_change_90d": -33.69549353,
    "market_cap": 22467279643.357746,
    "last_updated": "2021-06-17T05:09:06.000Z"
    }
    }
    },
    {
    "id": 7083,
    "name": "Uniswap",
    "symbol": "UNI",
    "slug": "uniswap",
    "num_market_pairs": 243,
    "date_added": "2020-09-17T00:00:00.000Z",
    "tags": [
    "decentralized-exchange",
    "defi",
    "dao",
    "yield-farming",
    "amm",
    "coinbase-ventures-portfolio",
    "three-arrows-capital-portfolio",
    "governance",
    "blockchain-capital-portfolio",
    "defiance-capital",
    "alameda-research-portfolio",
    "a16z-portfolio",
    "pantera-capital-portfolio",
    "parafi-capital",
    "paradigm-xzy-screener"
    ],
    "max_supply": 1000000000,
    "circulating_supply": 575171205.7341261,
    "total_supply": 1000000000,
    "platform": {
    "id": 1027,
    "name": "Ethereum",
    "symbol": "ETH",
    "slug": "ethereum",
    "token_address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"
    },
    "cmc_rank": 10,
    "last_updated": "2021-06-17T05:08:09.000Z",
    "quote": {
    "USD": {
    "price": 22.56451784002357,
    "volume_24h": 350488109.9040696,
    "percent_change_1h": -0.96799052,
    "percent_change_24h": -3.33917528,
    "percent_change_7d": -7.62455167,
    "percent_change_30d": -36.78384081,
    "percent_change_60d": -27.48069496,
    "percent_change_90d": -25.00466398,
    "market_cap": 12978460932.855555,
    "last_updated": "2021-06-17T05:08:09.000Z"
    }
    }
    }
    ]
    }''';

    var currData = jsonDecode(response) as Map<String, dynamic>;

    (currData['data']).forEach((dynamic item) {
    // Maybe you will need to cast to Map<String, dynamic>, but it works ok
    print(item['name']);
    });











    }