tcmb_api_client 0.0.2 copy "tcmb_api_client: ^0.0.2" to clipboard
tcmb_api_client: ^0.0.2 copied to clipboard

This Dart package provides a simple and efficient way to interact with the Central Bank of Republic of Türkiye (TCMB) API. It allows you to fetch exchange rates and other related data.

TCMB API CLIENT #

This Dart package provides a simple and efficient way to interact with the Central Bank of the Republic of Türkiye (TCMB) API. It allows you to fetch exchange rates and other related data.

Demo #

Demo

⚠️ Information Regarding Data #

This is a Dart client for the TCMB (Central Bank of the Republic of Türkiye) exchange rates API: https://www.tcmb.gov.tr/kurlar/{date}.xml. You can use dates such as today or 202404/22042024 as path parameters. Please note that the exchange rates provided are indicative and are announced by the Central Bank of the Republic of Türkiye, almost on a daily basis, hence they may not reflect real-time changes.

Features #

  • Fetch exchange rate for current date
  • Fetch exchange rates for a specific date
  • Fetch a single rate for a specific currency and date
  • Easy to use with a clean and simple API

Getting Started #

To use this package, add tcmb_api_client as a dependency in your pubspec.yaml file.

dependencies:
  tcmb_api_client: ^0.0.1
copied to clipboard

Usage #

Here's a simple example of using TcmbApiClient to fetch exchange rates:

import 'package:tcmb_api_client/tcmb_api_client.dart';

Future<List<Currency>> fetchRates() async {
    try {
      return await _apiClient.getRates();
    } catch (e) {
      debugPrint('Error fetching rates: $e');
      rethrow;
    }
  }

Future<Currency?> fetchUsdRate() async {
    try {
      return await _apiClient.getSingleRate(CurrencyCode.USD);
    } catch (e) {
      debugPrint('Error fetching rate: $e');
      rethrow;
    }
}
copied to clipboard

Testing and Coverage #

This package includes a comprehensive suite of unit tests, which ensures the reliability and correctness of the package's functionality. (Cov report added as an image just for now, will connect to a service later) Code Coverage Report

Disclaimer #

Please note that this package is not affiliated with, officially connected to, or endorsed by the Central Bank of the Republic of Türkiye (TCMB). The package is developed and maintained independently. The official TCMB website can be found at https://www.tcmb.gov.tr. The name TCMB as well as related names, marks, emblems and images are registered trademarks of their respective owners.

6
likes
130
points
36
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.09 - 2025.03.24

This Dart package provides a simple and efficient way to interact with the Central Bank of Republic of Türkiye (TCMB) API. It allows you to fetch exchange rates and other related data.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

collection, http, json_annotation, very_good_analysis, xml2json

More

Packages that depend on tcmb_api_client