/flutter_iexcloud_api

Flutter API Client for IEX Cloud.

Primary LanguageDartMIT LicenseMIT

flutter_iexcloud_api

Pub support Build Status

The IEX Cloud API client based on REST, has resource-oriented URLs, returns JSON-encoded responses, and returns standard HTTP response codes.

Note:

  • IEX Cloud authenticates your API requests using your account’s API tokens. To use any IEX Cloud API, you must pass an API token with each request. If you do not include your API token when making an API request, or use one that is incorrect or disabled, IEX Cloud returns an error.
  • Work in progress, Only REST Requests are supported.

For more details click here

Road map

API Collection Status Milestone
Status 1.0.x
Symbols 1.0.x
Cryptocurrency 1.0.x
News 1.1.x
Stocks / Equities 🧑‍💻 1.1.x
Corporate Actions 🧑‍💻 1.2.x
Market Info 🧑‍💻 1.2.x
Forex / Currencies 🧑‍💻 1.3.x
Options 🧑‍💻 1.3.x
Futures 🧑‍💻 1.3.x
CEO Compensation 🧑‍💻 1.3.x
Treasuries 🧑‍💻 1.3.x
Commodities 🧑‍💻 1.4.x
Economic Data 🧑‍💻 1.4.x
Reference Data 🧑‍💻 1.5.x
Investors Exchange Data 🧑‍💻 1.6.x
Premium Data 🧑‍💻 2.0.x

Get started

API Reference: https://iexcloud.io/docs/api/#api-reference

Add dependency

dependencies:
  flutter_iexcloud_api: ^1.0.02

Super simple to use

import 'package:flutter_iexcloud_api/flutter_iexcloud_api.dart';

late final IEXClientApi service = IEXClientApi(
  token: "<Your Token>",
);

final response = await service.cryptocurrencyPrice("btcbusd");

Configuration

property description default
token (required) API Token provided by iexcloud -
apiVersion (required) iexcloud API Version stable (see: ApiVersion)
connectTimeout It occurs when url is opened timeout. 5000
sendTimeout It occurs when url is sent timeout. 30000
receiveTimeout It occurs when receiving timeout. 30000

Interceptors

For each client instance, We can add one or more interceptors, by which we can intercept requests, responses and errors before they are handled by then or catchError.

Simple interceptor example

import 'package:dio/dio.dart';
class CustomInterceptors extends Interceptor {
  @override
  void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
    print('REQUEST[${options.method}] => PATH: ${options.path}');
    return super.onRequest(options, handler);
  }
  @override
  Future onResponse(Response response, ResponseInterceptorHandler handler) {
    print('RESPONSE[${response.statusCode}] => PATH: ${response.request?.path}');
    return super.onResponse(response, handler);
  }
  @override
  Future onError(DioError err, ErrorInterceptorHandler handler) {
    print('ERROR[${err.response?.statusCode}] => PATH: ${err.request.path}');
    return super.onError(err, handler);
  }
}

Registering the Interceptor

late final IEXClientApi service = IEXClientApi(
  token: "<Your Token>",
);
service.addInterceptor(CustomInterceptors());

Cleaning all interceptors

late final IEXClientApi service = IEXClientApi(
  token: "<Your Token>",
);
service.clearInterceptors();

For more details on how to use Interceptor, please check dio plugin page

Copyright & License

This open source project implemented by Tiarê Balbi Bonamini , and the license is MIT. Data provided by IEX Cloud

Features and bugs

Please file feature requests and bugs at the issue tracker.

Development Notes

dartdoc

Use dartdoc to generate HTML documentaton for your Dart package.

Reference: https://github.com/dart-lang/dartdoc#dartdoc

pana

A library for analyzing Dart packages. It invokes executables from the Dart SDK (or from the Flutter SDK if the package uses Flutter).

Reference: https://pub.dev/packages/pana