getAnalytics method
Implementation
@override
Future<Analytics> getAnalytics(
{int limit = 0, int offset = 0, String keyword = ''}) async {
try {
return await dio
.get(ApiEndpoints.ANALYTICS,
queryParameters: {
'limit': limit,
'offset': offset,
'search': keyword
},
options: Options(
validateStatus: (status) => status == 200 || status == 404))
.then((value) {
try {
return Analytics.fromJson(value.data);
} catch (e) {
logger.error(TAG, e.toString(), {'method': 'getAnalytics'});
}
return Analytics(list: []);
});
} on Exception catch (e) {
throw HttpHelper.decodeErrorResponse(e,
tag: TAG,
logger: logger,
defaultErrorMessage: 'Failed to get widgets with that keyword',
meta: {'method': 'getAnalytics'});
}
}