|
|
|
@@ -207,18 +207,18 @@ class _RestClient implements RestClient { |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
getWaterTypes() async { |
|
|
|
getWaterTypes({options}) async { |
|
|
|
const _extra = <String, dynamic>{}; |
|
|
|
final queryParameters = <String, dynamic>{}; |
|
|
|
queryParameters.removeWhere((k, v) => v == null); |
|
|
|
final _data = <String, dynamic>{}; |
|
|
|
final newOptions = newRequestOptions(options); |
|
|
|
newOptions.extra.addAll(_extra); |
|
|
|
newOptions.headers.addAll(<String, dynamic>{}); |
|
|
|
final Response<List<dynamic>> _result = await _dio.request( |
|
|
|
'/api/water-types', |
|
|
|
queryParameters: queryParameters, |
|
|
|
options: RequestOptions( |
|
|
|
method: 'GET', |
|
|
|
headers: <String, dynamic>{}, |
|
|
|
extra: _extra, |
|
|
|
baseUrl: baseUrl), |
|
|
|
options: newOptions.merge(method: 'GET', baseUrl: baseUrl), |
|
|
|
data: _data); |
|
|
|
var value = _result.data |
|
|
|
.map((dynamic i) => WaterType.fromJson(i as Map<String, dynamic>)) |
|
|
|
@@ -303,4 +303,28 @@ class _RestClient implements RestClient { |
|
|
|
.toList(); |
|
|
|
return value; |
|
|
|
} |
|
|
|
|
|
|
|
RequestOptions newRequestOptions(Options options) { |
|
|
|
if (options is RequestOptions) { |
|
|
|
return options; |
|
|
|
} |
|
|
|
if (options == null) { |
|
|
|
return RequestOptions(); |
|
|
|
} |
|
|
|
return RequestOptions( |
|
|
|
method: options.method, |
|
|
|
sendTimeout: options.sendTimeout, |
|
|
|
receiveTimeout: options.receiveTimeout, |
|
|
|
extra: options.extra, |
|
|
|
headers: options.headers, |
|
|
|
responseType: options.responseType, |
|
|
|
contentType: options.contentType.toString(), |
|
|
|
validateStatus: options.validateStatus, |
|
|
|
receiveDataWhenStatusError: options.receiveDataWhenStatusError, |
|
|
|
followRedirects: options.followRedirects, |
|
|
|
maxRedirects: options.maxRedirects, |
|
|
|
requestEncoder: options.requestEncoder, |
|
|
|
responseDecoder: options.responseDecoder, |
|
|
|
); |
|
|
|
} |
|
|
|
} |