getAllDevices method
Implementation
@override
Future<Devices> getAllDevices() async {
try {
return await dio
.get(ApiEndpoints.DEVICES,
queryParameters: {'limit': 1000000},
options: Options(
validateStatus: (status) => status == 200 || status == 404))
.then((value) {
try {
return Devices.fromJson(value.data);
} catch (e) {
logger.error(TAG, e.toString(), {'method': 'getAllDevices'});
}
return Devices(list: []);
});
} on Exception catch (e) {
throw HttpHelper.decodeErrorResponse(e,
tag: TAG,
logger: logger,
defaultErrorMessage: 'Failed to get all devices',
meta: {'method': 'getAllDevices'});
}
}