fetchConnectOptions method

  1. @override
Future<CourierConnectOptions> fetchConnectOptions()
override

Implementation

@override
Future<CourierConnectOptions> fetchConnectOptions() async {
  final response = await dio.get(tokenApi);
  if (response.statusCode == 200) {
    return authResponseMapper.map(response.data);
  } else {
    log('${response.statusCode} : ${response.data.toString()}');
    final requestOptions = RequestOptions(path: tokenApi);
    throw DioException(
        requestOptions: requestOptions,
        response: Response(
            requestOptions: requestOptions, statusCode: response.statusCode),
        type: DioExceptionType.connectionError);
  }
}