Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
Fixing new apis
Browse files Browse the repository at this point in the history
  • Loading branch information
tiarebalbi authored Apr 2, 2024
1 parent a696d11 commit a6d0ef4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Publish to pub.dev

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

jobs:
publish:
permissions:
id-token: write # Required for authentication using OIDC
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
5 changes: 1 addition & 4 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
include: package:pedantic/analysis_options.yaml
analyzer:
enable-experiment:
- non-nullable
include: package:pedantic/analysis_options.yaml
9 changes: 4 additions & 5 deletions lib/src/iex_client_api.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
library flutter_iexcloud_api;

import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_iexcloud_api/src/iex_error_handler.dart';

import 'models/models.dart';
Expand Down Expand Up @@ -39,9 +38,9 @@ class IEXClientApi {
/// DIO Client instance used to send all requests
late final Dio dio = Dio(BaseOptions(
baseUrl: '$baseUrl/${apiVersion.name}',
connectTimeout: connectTimeout,
sendTimeout: sendTimeout,
receiveTimeout: receiveTimeout,
connectTimeout: Duration(milliseconds: connectTimeout),
sendTimeout: Duration(milliseconds: sendTimeout),
receiveTimeout: Duration(milliseconds: receiveTimeout),
));

/// Constructor
Expand Down Expand Up @@ -118,7 +117,7 @@ class IEXClientApi {
try {
final response = await dio.get<Map<String, dynamic>?>(path);
return callback(response.data);
} on DioError catch (e) {
} on DioException catch (e) {
final errorMessage = IEXErrorHandler.from(e);
throw Exception(errorMessage);
}
Expand Down
12 changes: 5 additions & 7 deletions lib/src/iex_error_handler.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import 'package:dio/dio.dart';

class IEXErrorHandler {
static String from(DioError error) {
static String from(DioException error) {
switch (error.type) {
case DioErrorType.sendTimeout:
case DioErrorType.connectTimeout:
case DioErrorType.receiveTimeout:
case DioExceptionType.sendTimeout:
case DioExceptionType.connectionTimeout:
case DioExceptionType.receiveTimeout:
return 'Error to connect with the server, check your connection';
case DioErrorType.cancel:
case DioExceptionType.cancel:
return 'Request Cancelled';
case DioErrorType.response:
case DioErrorType.other:
default:
break;
}
Expand Down
3 changes: 1 addition & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: flutter_iexcloud_api
description: Flutter API Client to retrieve financial data using IEX Cloud data provider.
version: 1.0.2
author: tiarebalbi.com
homepage: https://github.com/tiarebalbi/flutter_iexcloud_api
issue_tracker: https://github.com/tiarebalbi/flutter_iexcloud_api/issues

environment:
sdk: ">=2.12.0-0 <3.0.0"
sdk: ">=2.15.0-0 <3.0.0"

dependencies:
flutter:
Expand Down

0 comments on commit a6d0ef4

Please sign in to comment.