dio_api_version_interceptor

Creator: coderz1093

Last updated:

0 purchases

dio_api_version_interceptor Image
dio_api_version_interceptor Images

Languages

Categories

Add to Cart

Description:

dio api version interceptor

Installation #
dependencies:
dio_api_version_interceptor: [version]
copied to clipboard
Usage #
Import the library
import 'package:dio_api_version_interceptor/dio_api_version_interceptor.dart';
copied to clipboard
You can use an explicit call to the endpoint to check the version compatibility.
final dio = Dio(BaseOptions(baseUrl: 'https://run.mocky.io'));
return dio.checkCompatibilityMapped(
path: '/v3/bb2dd989-d94a-46b8-9cdc-76d32a979dc3',
appVersion: appVersion,
);
copied to clipboard
Or you can use the Header Interceptor to check version on every response

final headerResultController =
StreamController<CompatibilityResult>;
...
final interceptor = ApiVersionHeaderInterceptor(
streamController: headerResultController,
appVersion: appVersion,
minSupportedVersion: VersionSupportType.minor,
);
dio = Dio(BaseOptions(baseUrl: 'https://run.mocky.io'))
..interceptors.add(interceptor);

return headerResultController.stream;
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.