Skip to content

Commit

Permalink
Custom params experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
uitlaber committed Jan 16, 2021
1 parent 19cff1e commit 10c97a9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/src/data_classes/query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ class Query extends OneQuery {
/// [Additional info](https://github.com/directus/directus/blob/main/docs/reference/api/query/offset.md)
int? offset;

Map<String, dynamic>? params;

/// Constructor for query. All fields are optional.
Query({
this.limit,
this.offset,
this.sort,
Map<String, Query>? deep,
List<String>? fields,
this.params,
}) : super(deep: deep, fields: fields);

/// Convert [Query] to [Map] so it can be passed to Dio for request.
Expand All @@ -64,6 +67,7 @@ class Query extends OneQuery {
'offset': offset,
'sort': sort?.join(','),
'deep': deep?.map((key, value) => MapEntry(key, value.toMap())),
...params ?? {}
}..removeWhere(
(key, value) => value == null,
);
Expand Down

0 comments on commit 10c97a9

Please sign in to comment.