checkCompatibility<T> method

Future<T> checkCompatibility<T>({
  1. required String path,
  2. required String appVersion,
  3. String queryParamKey = 'version',
  4. required T deserializeFn(
    1. Map<String, dynamic> json
    ),
})

Returns the result of api call to check the version.

path is the URL the endpoint that returns the response for GET request

appVersion is the app version string, for example '1.0.0'

queryParamKey is the query parameter name, default is 'version'

deserializeFn is the function callback to deserialize the response JSON

Implementation

Future<T> checkCompatibility<T>({
  required String path,
  required String appVersion,
  String queryParamKey = 'version',
  required T Function(Map<String, dynamic> json) deserializeFn,
}) =>
    get(path, queryParameters: {queryParamKey: appVersion}).then(
      (value) => deserializeFn(value.data),
    );