A powerful Http client for Dart, which supports Interceptors, FormData, Request Cancellation, File Downloading, Timeout etc.

Related tags

Templates dio_http
Overview

dio_http

Pub support

A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, Request Cancellation, File downloading, Timeout etc.

This package has been forked from Dio. To read why, click here.

Get started

Add dependency

dependencies:
  dio_http: ^5.0.4

Already know Dio 3 and just want to learn about what's new in Dio 4? Check out the Migration Guide!

Super simple to use

import 'package:dio_http/dio_http.dart';
void getHttp() async {
  try {
    var response = await Dio().get('http://www.google.com');
    print(response);
  } catch (e) {
    print(e);
  }
}

awesome-dio

🎉 A curated list of awesome things related to dio.

Plugins (support 4.0)

Plugins Status Description
dio_cookie_manager Pub A cookie manager for Dio
dio_http2_adapter Pub A Dio HttpClientAdapter which support Http/2.0

Table of contents

Examples

Performing a GET request:

Response response;
var dio = Dio();
response = await dio.get('/test?id=12&name=wendu');
print(response.data.toString());
// Optionally the request above could also be done as
response = await dio.get('/test', queryParameters: {'id': 12, 'name': 'wendu'});
print(response.data.toString());

Performing a POST request:

response = await dio.post('/test', data: {'id': 12, 'name': 'wendu'});

Performing multiple concurrent requests:

response = await Future.wait([dio.post('/info'), dio.get('/token')]);

Downloading a file:

response = await dio.download('https://www.google.com/', './xx.html');

Get response stream:

Response<ResponseBody> rs;
rs = await Dio().get<ResponseBody>(url,
  options: Options(responseType: ResponseType.stream),  // set responseType to `stream`
);
print(rs.data.stream); //response stream

Get response with bytes:

Response<List<int>> rs 
rs = await Dio().get<List<int>>(url,
 options: Options(responseType: ResponseType.bytes), // set responseType to `bytes`
);
print(rs.data); // List<int>

Sending FormData:

var formData = FormData.fromMap({
  'name': 'wendux',
  'age': 25,
});
var response = await dio.post('/info', data: formData);

Uploading multiple files to server by FormData:

var formData = FormData.fromMap({
  'name': 'wendux',
  'age': 25,
  'file': await MultipartFile.fromFile('./text.txt', filename: 'upload.txt'),
  'files': [
    await MultipartFile.fromFile('./text1.txt', filename: 'text1.txt'),
    await MultipartFile.fromFile('./text2.txt', filename: 'text2.txt'),
  ]
});
var response = await dio.post('/info', data: formData);

Listening the uploading progress:

response = await dio.post(
  'http://www.dtworkroom.com/doris/1/2.0.0/test',
  data: {'aa': 'bb' * 22},
  onSendProgress: (int sent, int total) {
    print('$sent $total');
  },
);

Post binary data by Stream:

// Binary data
List<int> postData = <int>[...];
await dio.post(
  url,
  data: Stream.fromIterable(postData.map((e) => [e])), //create a Stream<List<int>>
  options: Options(
    headers: {
      Headers.contentLengthHeader: postData.length, // set content-length
    },
  ),
);

…you can find all examples code here.

Dio APIs

Creating an instance and set default configs.

You can create instance of Dio with an optional BaseOptions object:

var dio = Dio(); // with default Options

// Set default configs
dio.options.baseUrl = 'https://www.xx.com/api';
dio.options.connectTimeout = 5000; //5s
dio.options.receiveTimeout = 3000;

// or new Dio with a BaseOptions instance.
var options = BaseOptions(
  baseUrl: 'https://www.xx.com/api',
  connectTimeout: 5000,
  receiveTimeout: 3000,
);
Dio dio = Dio(options);

The core API in Dio instance is:

Future request(String path, {data,Map queryParameters, Options options,CancelToken cancelToken, ProgressCallback onSendProgress, ProgressCallback onReceiveProgress)

response = await dio.request(
  '/test',
  data: {'id':12,'name':'xx'},
  options: Options(method:'GET'),
);

Request method aliases

For convenience aliases have been provided for all supported request methods.

Future get(...)

Future post(...)

Future put(...)

Future delete(...)

Future head(...)

Future put(...)

Future path(...)

Future download(...)

Future fetch(RequestOptions) new*

Request Options

The Options class describes the http request information and configuration. Each Dio instance has a base config for all requests maked by itself, and we can override the base config with [Options] when make a single request. The [BaseOptions] declaration as follows:

{
  /// Http method.
  String method;

  /// Request base url, it can contain sub path, like: 'https://www.google.com/api/'.
  String baseUrl;

  /// Http request headers.
  Map<String, dynamic> headers;

   /// Timeout in milliseconds for opening  url.
  int connectTimeout;

   ///  Whenever more than [receiveTimeout] (in milliseconds) passes between two events from response stream,
  ///  [Dio] will throw the [DioError] with [DioErrorType.RECEIVE_TIMEOUT].
  ///  Note: This is not the receiving time limitation.
  int receiveTimeout;

  /// Request data, can be any type.
  T data;

  /// If the `path` starts with 'http(s)', the `baseURL` will be ignored, otherwise,
  /// it will be combined and then resolved with the baseUrl.
  String path='';

  /// The request Content-Type. The default value is 'application/json; charset=utf-8'.
  /// If you want to encode request body with 'application/x-www-form-urlencoded',
  /// you can set [Headers.formUrlEncodedContentType], and [Dio]
  /// will automatically encode the request body.
  String contentType;

  /// [responseType] indicates the type of data that the server will respond with
  /// options which defined in [ResponseType] are `JSON`, `STREAM`, `PLAIN`.
  ///
  /// The default value is `JSON`, dio will parse response string to json object automatically
  /// when the content-type of response is 'application/json'.
  ///
  /// If you want to receive response data with binary bytes, for example,
  /// downloading a image, use `STREAM`.
  ///
  /// If you want to receive the response data with String, use `PLAIN`.
  ResponseType responseType;

  /// `validateStatus` defines whether the request is successful for a given
  /// HTTP response status code. If `validateStatus` returns `true` ,
  /// the request will be perceived as successful; otherwise, considered as failed.
  ValidateStatus validateStatus;

  /// Custom field that you can retrieve it later in [Interceptor][Transformer] and the   [Response] object.
  Map<String, dynamic> extra;
  
  /// Common query parameters
  Map<String, dynamic /*String|Iterable<String>*/ > queryParameters;  
  
   /// [collectionFormat] indicates the format of collection data in request
  /// options which defined in [CollectionFormat] are `csv`, `ssv`, `tsv`, `pipes`, `multi`,`multiCompatible`.
  /// The default value is `multiCompatible`
  late CollectionFormat collectionFormat;

}

There is a complete example here.

Response Schema

The response for a request contains the following information.

{
  /// Response body. may have been transformed, please refer to [ResponseType].
  T? data;
  /// Response headers.
  Headers headers;
  /// The corresponding request info.
  RequestOptions requestOptions;
  /// Http status code.
  int? statusCode;
  String? statusMessage;
  /// Whether redirect 
  bool? isRedirect;  
  /// redirect info    
  List<RedirectInfo> redirects ;
  /// Returns the final real request uri (maybe redirect). 
  Uri realUri;    
  /// Custom field that you can retrieve it later in `then`.
  Map<String, dynamic> extra;
}

When request is succeed, you will receive the response as follows:

Response response = await dio.get('https://www.google.com');
print(response.data);
print(response.headers);
print(response.requestOptions);
print(response.statusCode);

Interceptors

For each dio 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.

dio.interceptors.add(InterceptorsWrapper(
    onRequest:(options, handler){
     // Do something before request is sent
     return handler.next(options); //continue
     // If you want to resolve the request with some custom data,
     // you can resolve a `Response` object eg: `handler.resolve(response)`.
     // If you want to reject the request with a error message,
     // you can reject a `DioError` object eg: `handler.reject(dioError)`
    },
    onResponse:(response,handler) {
     // Do something with response data
     return handler.next(response); // continue
     // If you want to reject the request with a error message,
     // you can reject a `DioError` object eg: `handler.reject(dioError)` 
    },
    onError: (DioError e, handler) {
     // Do something with response error
     return  handler.next(e);//continue
     // If you want to resolve the request with some custom data,
     // you can resolve a `Response` object eg: `handler.resolve(response)`.  
    }
));

Simple interceptor example:

import 'package:dio_http/dio_http.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);
  }
}

Resolve and reject the request

In all interceptors, you can interfere with their execution flow. If you want to resolve the request/response with some custom data,you can call handler.resolve(Response). If you want to reject the request/response with a error message, you can call handler.reject(dioError) .

dio.interceptors.add(InterceptorsWrapper(
  onRequest:(options, handler) {
   return handler.resolve(Response(requestOptions:options,data:'fake data'));
  },
));
Response response = await dio.get('/test');
print(response.data);//'fake data'

Lock/unlock the interceptors

You can lock/unlock the interceptors by calling their lock()/unlock method. Once the request/response interceptor is locked, the incoming request/response will be added to a queue before they enter the interceptor, they will not be continued until the interceptor is unlocked.

tokenDio = Dio(); //Create a new instance to request the token.
tokenDio.options = dio.options.copyWith();
dio.interceptors.add(InterceptorsWrapper(
  onRequest:(Options options, handler){
    // If no token, request token firstly and lock this interceptor
    // to prevent other request enter this interceptor.
    dio.interceptors.requestLock.lock();
    // We use a new Dio(to avoid dead lock) instance to request token.
    tokenDio.get('/token').then((response){
       //Set the token to headers
       options.headers['token'] = response.data['data']['token'];
       handler.next(options); //continue
    }).catchError((error, stackTrace) {
       handler.reject(error, true);
    }).whenComplete(() => dio.interceptors.requestLock.unlock());
  }
));

You can clean the waiting queue by calling clear();

aliases

When the request interceptor is locked, the incoming request will pause, this is equivalent to we locked the current dio instance, Therefore, Dio provied the two aliases for the lock/unlock of request interceptors.

dio.lock() == dio.interceptors.requestLock.lock()

dio.unlock() == dio.interceptors.requestLock.unlock()

dio.clear() == dio.interceptors.requestLock.clear()

Example

Because of security reasons, we need all the requests to set up a csrfToken in the header, if csrfToken does not exist, we need to request a csrfToken first, and then perform the network request, because the request csrfToken progress is asynchronous, so we need to execute this async request in request interceptor. The code is as follows:

dio.interceptors.add(InterceptorsWrapper(
  onRequest: (Options options, handler) async {
    print('send request:path:${options.path},baseURL:${options.baseUrl}');
    if (csrfToken == null) {
      print('no token,request token firstly...');
      //lock the dio.
      dio.lock();
      tokenDio.get('/token').then((d) {
        options.headers['csrfToken'] = csrfToken = d.data['data']['token'];
        print('request token succeed, value: ' + d.data['data']['token']);
        print( 'continue to perform request:path:${options.path},baseURL:${options.path}');
        handler.next(options);
      }).catchError((error, stackTrace) {
        handler.reject(error, true);
      }) .whenComplete(() => dio.unlock()); // unlock the dio
    } else {
      options.headers['csrfToken'] = csrfToken;
      handler.next(options);
    }
  }
));

For complete codes click here.

Log

You can set LogInterceptor to print request/response log automaticlly, for example:

dio.interceptors.add(LogInterceptor(responseBody: false)); //开启请求日志

Custom Interceptor

You can custom interceptor by extending the Interceptor class. There is an example that implementing a simple cache policy: custom cache interceptor.

Cookie Manager

dio_cookie_manager package is a cookie manager for Dio.

Handling Errors

When a error occurs, Dio will wrap the Error/Exception to a DioError:

try {
  //404
  await dio.get('https://wendux.github.io/xsddddd');
} on DioError catch (e) {
  // The request was made and the server responded with a status code
  // that falls out of the range of 2xx and is also not 304.
  if (e.response) {
    print(e.response.data)
    print(e.response.headers)
    print(e.response.requestOptions)
  } else {
    // Something happened in setting up or sending the request that triggered an Error
    print(e.requestOptions)
    print(e.message)
  }
}

DioError scheme

 {
  /// Response info, it may be `null` if the request can't reach to
  /// the http server, for example, occurring a dns error, network is not available.
  Response? response;
  /// Request info.
  RequestOptions? requestOptions;
  /// Error descriptions.
  String message;

  DioErrorType type;
  /// The original error/exception object; It's usually not null when `type`
  /// is DioErrorType.DEFAULT
  dynamic? error;
}

DioErrorType

enum DioErrorType {
  /// It occurs when url is opened timeout.
  connectTimeout,

  /// It occurs when url is sent timeout.
  sendTimeout,

  ///It occurs when receiving timeout.
  receiveTimeout,

  /// When the server response, but with a incorrect status, such as 404, 503...
  response,

  /// When the request is cancelled, dio will throw a error with this type.
  cancel,

  /// Default error type, Some other Error. In this case, you can
  /// use the DioError.error if it is not null.
  other,
}

Using application/x-www-form-urlencoded format

By default, Dio serializes request data(except String type) to JSON. To send data in the application/x-www-form-urlencoded format instead, you can :

//Instance level
dio.options.contentType= Headers.formUrlEncodedContentType;
//or works once
dio.post(
  '/info',
  data: {'id': 5},
  options: Options(contentType: Headers.formUrlEncodedContentType),
);

Sending FormData

You can also send FormData with Dio, which will send data in the multipart/form-data, and it supports uploading files.

var formData = FormData.fromMap({
  'name': 'wendux',
  'age': 25,
  'file': await MultipartFile.fromFile('./text.txt',filename: 'upload.txt')
});
response = await dio.post('/info', data: formData);

There is a complete example here.

Multiple files upload

There are two ways to add multiple files to FormData, the only difference is that upload keys are different for array types。

FormData.fromMap({
  'files': [
    MultipartFile.fromFileSync('./example/upload.txt', filename: 'upload.txt'),
    MultipartFile.fromFileSync('./example/upload.txt', filename: 'upload.txt'),
  ]
});

The upload key eventually becomes 'files[]',This is because many back-end services add a middle bracket to key when they get an array of files. If you don't want “[]”,you should create FormData as follows(Don't use FormData.fromMap):

var formData = FormData();
formData.files.addAll([
  MapEntry('files',
    MultipartFile.fromFileSync('./example/upload.txt',filename: 'upload.txt'),
  ),
  MapEntry('files',
    MultipartFile.fromFileSync('./example/upload.txt',filename: 'upload.txt'),
  ),
]);

Transformer

Transformer allows changes to the request/response data before it is sent/received to/from the server. This is only applicable for request methods 'PUT', 'POST', and 'PATCH'. Dio has already implemented a DefaultTransformer, and as the default Transformer. If you want to customize the transformation of request/response data, you can provide a Transformer by your self, and replace the DefaultTransformer by setting the dio.transformer.

In flutter

If you use dio in flutter development, you'd better to decode json in background with [compute] function.

// Must be top-level function
_parseAndDecode(String response) {
  return jsonDecode(response);
}

parseJson(String text) {
  return compute(_parseAndDecode, text);
}

void main() {
  ...
  //Custom jsonDecodeCallback
  (dio.transformer as DefaultTransformer).jsonDecodeCallback = parseJson;
  runApp(MyApp());
}

Other Example

There is an example for customizing Transformer.

HttpClientAdapter

HttpClientAdapter is a bridge between Dio and HttpClient.

Dio implements standard and friendly API for developer.

HttpClient: It is the real object that makes Http requests.

We can use any HttpClient not just dart:io:HttpClient to make the Http request. And all we need is providing a HttpClientAdapter. The default HttpClientAdapter for Dio is DefaultHttpClientAdapter.

dio.httpClientAdapter = new DefaultHttpClientAdapter();

Here is a simple example to custom adapter.

Using proxy

DefaultHttpClientAdapter provide a callback to set proxy to dart:io:HttpClient, for example:

import 'package:dio_http/dio_http.dart';
import 'package:dio_http/adapter.dart';
...
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
  // config the http client
  client.findProxy = (uri) {
    //proxy all request to localhost:8888
    return 'PROXY localhost:8888';
  };
  // you can also create a new HttpClient to dio
  // return HttpClient();
};

There is a complete example here.

Https certificate verification

There are two ways to verify the https certificate. Suppose the certificate format is PEM, the code like:

String PEM='XXXXX'; // certificate content
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate  = (client) {
  client.badCertificateCallback=(X509Certificate cert, String host, int port){
    if(cert.pem==PEM){ // Verify the certificate
      return true;
    }
    return false;
  };
};

Another way is creating a SecurityContext when create the HttpClient:

(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate  = (client) {
  SecurityContext sc = SecurityContext();
  //file is the path of certificate
  sc.setTrustedCertificates(file);
  HttpClient httpClient = HttpClient(context: sc);
  return httpClient;
};

In this way, the format of certificate must be PEM or PKCS12.

Http2 support

dio_http2_adapter package is a Dio HttpClientAdapter which support Http/2.0 .

Cancellation

You can cancel a request using a cancel token. One token can be shared with multiple requests. When a token's cancel method invoked, all requests with this token will be cancelled.

CancelToken token = CancelToken();
dio.get(url, cancelToken: token)
   .catchError((DioError err){
    if (CancelToken.isCancel(err)) {
      print('Request canceled! '+ err.message)
    }else{
      // handle error.
    }
   });
// cancel the requests with "cancelled" message.
token.cancel('cancelled');

There is a complete example here.

Extends Dio class

Dio is a abstract class with factory constructor,so we don't extend Dio class directy. For this purpose, we can extend DioForNative or DioForBrowser instead, for example:

import 'package:dio_http/dio_http.dart';
import 'package:dio_http/native_imp.dart'; //If in browser, import 'package:dio_http/browser_imp.dart'

class Http extends DioForNative {
  Http([BaseOptions options]):super(options){
    // do something
  }
}

We can also implement our Dio client:

class MyDio with DioMixin implements Dio{
  // ...
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Issues
  • A lot of timeouts

    A lot of timeouts

    New Issue Checklist

    • [x] I have searched for a similar issue in the project and found none

    Issue Info

    | Info | Value | | | ------------------------------ | ----------------------------------------------------- | ---- | | Platform Name | e.g. flutter / ios / android | flutter | | Platform Version | e.g. 1.5.0 / 12.0 / 9.0 | all | | Dio Version | e.g. 2.1.0 / 1.0.17 | 5.0.4 | | Android Studio / Xcode Version | e.g. Android Studio 3.3.2 / Xcode 10.2.1 | Android Studio Arctic Fox 2020.3.1 | | Repro rate | e.g. all the time (100%) / sometimes x% / only once | 50% | | Repro with our demo prj | e.g. does it happen with our demo project? | / | | Demo project link | e.g. link to a demo project that highlights the issue | / |

    Issue Description and Steps

    I get a lot of errors en Sentry and sometimes during debugging that there is a timeout, but this timeout seems to be false. It seems like this happens in the original Dio package as well. This happens quite frequently, so it would be nice if this is fxied.

    opened by vixez 11
  • Support multi-threaded downloads

    Support multi-threaded downloads

    New Issue Checklist

    • [x] I have searched for a similar issue in the project and found none

    Issue Info

    | Info | Value | | | ------------------------------ | ----------------------------------------------------- | ---- | | Platform Name | flutter | | | Platform Version | any | | | Dio Version | latest | | | Android Studio / Xcode Version | e.g. Android Studio 3.3.2 / Xcode 10.2.1 | | | Repro rate | e.g. all the time (100%) / sometimes x% / only once | | | Repro with our demo prj | e.g. does it happen with our demo project? | | | Demo project link | e.g. link to a demo project that highlights the issue | |

    Issue Description and Steps

    There were many stale issues on dio's issue tracker regarding this as far as I remember. Multi-threaded downloads are always good for a better downloading experience.

    opened by prateekmedia 5
  • Add pause / resume just like flowder

    Add pause / resume just like flowder

    New Issue Checklist
    • [x] I have searched for a similar issue in the project and found none

    Issue Info

    | Info | Value | | | ------------------------------ | ----------------------------------------------------- | ---- | | Platform Name | flutter | | | Platform Version | any | | | Dio Version | latest | | | Android Studio / Xcode Version | e.g. Android Studio 3.3.2 / Xcode 10.2.1 | | | Repro rate | e.g. all the time (100%) / sometimes x% / only once | | | Repro with our demo prj | e.g. does it happen with our demo project? | | | Demo project link | e.g. link to a demo project that highlights the issue | |

    Issue Description and Steps

    There were many stale issues on dio's issue tracker like flutterchina/dio#1020 flutterchina/dio#399 flutterchina/dio#395. Pause and resume for downloads are always good for a better downloading experience.

    This can be added by replacing CancelToken with more advanced DownloadToken or DioToken, which will contain all action like .cancel, .pause, .resume or isCancelled, isPaused, isResumed or something like that.

    This can be inspired from an existing package called flowder.

    At last I wish dio_http will became a successor of dio and will contribute back to dio when it get's maintainance back on track.

    opened by prateekmedia 3
  • ErrorInterceptorHandler(handler) doesn't work after unlocking dio

    ErrorInterceptorHandler(handler) doesn't work after unlocking dio

    New Issue Checklist

    • [x] I have searched for a similar issue in the project and found none

    Issue Info

    | Info | Value | | | ------------------------------ | ----------------------------------------------------- | ---- | | Platform Name | flutter | | | Platform Version | 2.0.5 | | | Dio Version | 5.0.4 | | | Android Studio / Xcode Version | 4.3.1 | | | Repro rate | all the time | | | Repro with our demo prj | e.g. does it happen with our demo project? | | | Demo project link | e.g. link to a demo project that highlights the issue | |

    Issue Description and Steps

    Please fill in the detailed description of the issue (full output of any stack trace, compiler error, ...) and the steps to reproduce the issue.

    am using an interceptor and discovered something very odd during the usage. Am using the interceptor for refreshing the access token incase it expires. I only retry the request once and if that fails, am using the handler.next to complete the error..

    Screen Shot 2021-09-08 at 5 41 12 PM

    when an error occurs without need to refresh the token ( lock , refresh the token and unlock the dio instance, then remake the previous request as shown in the pic), the handler.next function works fine and is able to pass back the error to my try-catch block...HOWEVER, when the access-token is refreshed and the previous request is re-made with the new acquired token, incase the request fails with an error e.g 4xx,5xx or any error, the onError is recalled and the handler.next function fires but the error is never caught by the try-catch block of my calling function Screen Shot 2021-09-08 at 5 22 19 PM Screen Shot 2021-09-08 at 5 23 24 PM

    opened by Okiring 2
  • How to use dio_cookie_manager with dio_http?

    How to use dio_cookie_manager with dio_http?

    Hey! How can I use dio_cookie_manager with dio_http?

    dio_cookie_manager imports usual dio, is there any version with dio_http import?

    opened by maxim-gapeenko-idf 2
  • dio htto cookie - exception ._rootRunUnary (.java)

    dio htto cookie - exception ._rootRunUnary (.java)

    Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError FileSystemException: Deletion failed, path = '/data/user/0/com.foryou.challenge/app_flutter/.cookies/ie0_ps1/' (OS Error: Invalid argument, errno = 22). Error thrown null.

    Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: FileSystemException: Deletion failed, path = '/data/user/0/com.aaa.aaa/app_flutter/.cookies/ie0_ps1/' (OS Error: Invalid argument, errno = 22). Error thrown null. at ._rootRunUnary(.java) at FileStorage.deleteAll(FileStorage.java:30) at PersistCookieJar.deleteAll(PersistCookieJar.java:165) at AppHttpClient.fetchNewCookieCookie(AppHttpClient.java:73) at AppHttpClient.init(AppHttpClient.java:57) at .initApp(.java:30) at _FutureBuilderState._subscribe.(_subscribe.java:794)

    opened by yyyy-ltd 2
  • unnecesary ? statement

    unnecesary ? statement

    New Pull Request Checklist

    • [X] I have read the Documentation
    • [X] I have searched for a similar pull request in the project and found none
    • [X] I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)
    • [X] I have added the required tests to prove the fix/feature I am adding
    • [X] I have updated the documentation (if necessary)
    • [X] I have run the tests and they pass

    This merge request fixes / refers to the following issues: ...

    Pull Request Description

    I just remove some unnecessary or implicit ? statements as well a unnecessary wrapper

    opened by unacorbatanegra 2
  • Support dio_http_cache plugin

    Support dio_http_cache plugin

    New Issue Checklist

    • [x] I have searched for a similar issue in the project and found none

    Issue Description and Steps

    Please provide official dio_http_cache plugin support.

    opened by Reprevise 1
  • Readme plugin pub links in wrong order

    Readme plugin pub links in wrong order

    New Issue Checklist

    • [x] I have searched for a similar issue in the project and found none

    Issue Info

    dio_cookie_manager -> https://pub.dartlang.org/packages/dio_http2_adapter dio_http2_adapter -> https://pub.dartlang.org/packages/dio_cookie_manager

    opened by Jaakkonen 1
  • Error with non signed certificates

    Error with non signed certificates

    • Using with platform: WEB
    • dio_http: ^5.0.4
    • Flutter: 2.5

    Same request with non signed certificate that in windows, ios, android returns ok, mac not tested, with web project get this error:

    Error: Expected a value of type 'DefaultHttpClientAdapter', but got one of type 'BrowserHttpClientAdapter'

    This is the code used to avoid certificate error, as I said, work for Androis, iOS and Windows (not tested for Mac):

      (_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
          (HttpClient client) {
        client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
        return client;
      };
    
    opened by tuskinhu 1
Releases(5.0.4)
A music player component for Flutter (i.e. Spotify, Apple Music, etc.) [AGPL/example/no longer maintaining]

This is an example I currently have no plans of putting this on Pub. Originally, I did, but I lost interest. However, I think this is a good example,

Tobe Osakwe 205 Oct 28, 2021
Flutter form fields designed to take much of the burden of form-related coding off the programmer's back — masks, validations, keyboard type, etc.

well_formed Contents Overview Getting Started Demo application References Overview Well-Formed Widget Fields - Well-Formed - is a collection of Flutte

Dartoos 5 Dec 1, 2021
Dart client library to interact with Supabase Storage

storage-dart Dart client library to interact with Supabase Storage. Contributing Fork the repo on GitHub Clone the project to your own machine Commit

Supabase 14 Nov 12, 2021
Pure Dart Client for Nakama Server 🌟🥰🤩

Nakama Flutter Client ?? ?? ?? ?? Nakama is an open-source scalable game server. This is a Flutter client for Nakama written in pure dart and supports

Oliver Brunsmann 20 Oct 6, 2021
A streaming client for the Komga self-hosted comics/manga/BD server targeting Android/iOS written in Dart/Flutter

Klutter A streaming client for the Komga self-hosted comics/manga/BD server targeting Android/iOS written in Dart/Flutter Background This is a project

Mark Winckle 24 Nov 29, 2021
Dart client for Typesense

Typesense Dart client library for accessing the HTTP API of Typesense search engine. Note: This package is still under development. Version 0.2.0 will

Typesense 20 Nov 15, 2021
A quick and powerful Flutter layout with a bottom navbar.

What is bottom_nav_layout? It is a quick flutter app layout for building an app with a bottom nav bar. You can get an app with fluent behavior running

Mustafa Azyoksul 25 Nov 28, 2021
Authentication API client with Flutter (Login, Register, Google Login, Facebook Login, Apple Login)

Flutter Auth App (Login, Register, Google Login, Facebook Login, Apple Login) To use this client, get the server up and running. Try it out now! App S

Denzel Giraldo 15 Nov 29, 2021
a flutter socket client sdk for ezyfox-server

ezyfox-server-flutter-client flutter client for ezyfox server Architecture Offical documentation https://youngmonkeys.org/ezyfox-flutter-client-sdk/ P

Young Monkeys 36 Oct 26, 2021
Sample Flutter Drawing App which allows the user to draw onto the canvas along with color picker and brush thickness slider.

DrawApp Sample Flutter Drawing App which allows the user to draw onto the canvas along with color picker and brush thickness slider. All code free to

Jake Gough 208 Nov 8, 2021
A Boilerplate Project which adopts the concept of Clean Architecture and Modularization.

Flutter-Works Boilerplate Table Of Content Overview Getting Started Requirement Setup Setup Firebase Android IOS Change Package Name Running/Debugger

KodingWorks 30 Nov 17, 2021
An E-Commerce application developed on Flutter, which helps to run the app on Android / IOS / Windows's OS / MacOS / Web Browser from a single codebase

BuySmart An E-Commerce application developed on Flutter, which helps to run the app on Android / IOS / Windows's OS / MacOS / Web Browser from a singl

Sumit Kumar 8 Nov 15, 2021
Docker images for the Dart programming language (https://dart.dev)

dart-docker This is the Git repo of the Docker "Official Images" for the Dart programming language. See the Docker Hub page for a full description on

Dart 33 Nov 17, 2021
Android App written with Flutter/Dart to navigate medium.com without limitations.

Medium Unlimited An Android application written with Flutter/Dart to read medium.com without limitations. Features Read medium without reading limits

null 13 Nov 21, 2021
Dart / Flutter package that allows discovering network devices in local network (LAN).

lan_scanner Dart / Flutter package that allows discovering network devices in local network (LAN). Note: This library is intended to be used on Class

null 5 Aug 27, 2021
Dart, Flutter, Google Cloud, and ranked voting!

Try it out Hosted at https://knarlyvote.com tl;dr A (work-in-progress) demonstration of: (1) a full-stack Flutter application utilizing Firebase and G

Kevin Moore 22 Oct 29, 2021