0 purchases
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.