toQueryParams method
Convert filter to query parameters for backend requests
This allows the backend to filter data before sending it, reducing bandwidth usage.
Implementation
Map<String, dynamic> toQueryParams() {
final params = <String, dynamic>{};
if (where != null) {
// Convert where conditions to query params
// Format: where[field]=value
for (final entry in where!.entries) {
params['where[${entry.key}]'] = entry.value.toString();
}
}
if (since != null) {
params['since'] = since!.toIso8601String();
}
if (limit != null) {
params['limit'] = limit.toString();
}
if (fields != null) {
params['fields'] = fields!.join(',');
}
if (excludeFields != null) {
params['excludeFields'] = excludeFields!.join(',');
}
return params;
}