asMap property

Map<String, dynamic> get asMap

Implementation

Map<String, dynamic> get asMap {
  Map<String, dynamic> retval = {
    'per_page': perPage,
    'offset': pageOffset,
    '_get_all': getAll,
  };
  if (order != null) retval['order'] = order;

  if (include.isNotEmpty) retval['include'] = include.join(',');
  if (filter.isNotEmpty) retval['filter'] = filter.join(',');

  for (var w in where) {
    var key = w.attribute;
    var value = w.value;
    var op = w.operator == null ? '' : '[${w.operator}]';
    retval['where[$key]$op'] = value;
  }

  // if the user specified extra params, we add them now
  if (extraParams.isNotEmpty) {
    extraParams.forEach((key, value) {
      retval[key] = value;
    });
  }

  return retval;
}