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 :white_check_mark: 1.0.x
Symbols :white_check_mark: 1.0.x
Cryptocurrency :white_check_mark: 1.0.x
News :white_check_mark: 1.1.x
Stocks / Equities :technologist: 1.1.x
Corporate Actions :technologist: 1.2.x
Market Info :technologist: 1.2.x
Forex / Currencies :technologist: 1.3.x
Options :technologist: 1.3.x
Futures :technologist: 1.3.x
CEO Compensation :technologist: 1.3.x
Treasuries :technologist: 1.3.x
Commodities :technologist: 1.4.x
Economic Data :technologist: 1.4.x
Reference Data :technologist: 1.5.x
Investors Exchange Data :technologist: 1.6.x
Premium Data :technologist: 2.0.x

Get started

API Reference: 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

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: 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: pub.dev/packages/pana