m8ty_client_cryptocoins
Package overview
Section titled “Package overview”m8ty_client_cryptocoins solves this by providing coin listings, images, and K-Line market data through a typed client, enabling recognizable and informative crypto experiences.
Access list of available coins including of their icons. Stream of data is also exposed about their market values
Before you start
Section titled “Before you start”Check the documentation of the m8ty_client_cryptocoins library to get an idea about the available models and their properties.
import all needed libraries
Section titled “import all needed libraries” import 'package:dio/dio.dart'; import 'package:m8ty_client_cryptocoins/m8ty_client_cryptocoins.dart'; import 'package:m8ty_client_common/m8ty_client_common.dart'; import 'package:built_collection/built_collection.dart';How to perform different tasks
Section titled “How to perform different tasks”Here some examples how the dart client can be used
List all crypto coins
Section titled “List all crypto coins” final client = M8tyClientCryptocoins(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCryptoCoinsApi();
try { final response = await api.listAllCryptoCoins(); print('Coins: ${response.data}'); } on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', ); }Retrieve crypto coin image
Section titled “Retrieve crypto coin image” final client = M8tyClientCryptocoins(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCryptoCoinsApi(); final Response<Uint8List> response = await api.retrieveCryptoImage( coinId: 'bitcoin', );Retrieve K-Line chart data
Section titled “Retrieve K-Line chart data” final client = M8tyClientCryptocoins(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCryptoCoinsApi(); final response = await api.retrieveKlineDataForCrypto( coinId: 'bitcoin', );© m8ty GmbH 2023 · m8ty.eu
