getAll method

  1. @override
Future<List> getAll({
  1. String partOfUrl = '',
  2. String apiUserToken = '',
})
override

Implementation

@override
Future<List<dynamic>> getAll({
  String partOfUrl = '',
  String apiUserToken = '',
}) async {
  Dio _dio = dio;
  Map<String, dynamic> queryParameters = dio.options.queryParameters;

  if (apiUserToken.isNotEmpty) {
    if (queryParameters.containsKey("api_token")) {
      _dio = copyDio(dio.options);

      queryParameters.remove('api_token');
      queryParameters.addAll({'api_token': apiUserToken});
    }

    _dio.options.queryParameters = queryParameters;
  }

  var url = "$baseURI";

  if (partOfUrl.isNotEmpty) {
    url += '$partOfUrl';
  }

  var result = await _dio.get(url);

  return result.data is String ? json.decode(result.data) : result.data;
}