dio_compatibility_layer

Creator: coderz1093

Last updated:

0 purchases

dio_compatibility_layer Image
dio_compatibility_layer Images

Languages

Categories

Add to Cart

Description:

dio compatibility layer

dio_compatibility_layer #




If you encounter bugs, consider fixing it by opening a PR or at least contribute a failing test case.
This package contains adapters for Dio
which enables you to make use of other HTTP clients as the underlying implementation.
Currently, it supports compatibility with

http

Get started #
Install #
Add the dio_compatibility_layer package to your
pubspec dependencies.
Example #
To use the http compatibility:
import 'package:dio/dio.dart';
import 'package:dio_compatibility_layer/dio_compatibility_layer.dart';
import 'package:http/http.dart';

void main() async {
// Start in the `http` world. You can use `http`, `cronet_http`,
// `cupertino_http` and other `http` compatible packages.
final httpClient = Client();

// Make the `httpClient` compatible via the `ConversionLayerAdapter` class.
final dioAdapter = ConversionLayerAdapter(httpClient);

// Make dio use the `httpClient` via the conversion layer.
final dio = Dio()..httpClientAdapter = dioAdapter;

// Make a request
final response = await dio.get('https://dart.dev');
print(response);
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.