pocketbase / dart-sdk

PocketBase Dart SDK
https://pub.dev/packages/pocketbase
MIT License
511 stars 51 forks source link

Issue with filtering in dart-sdk #33

Closed appboy-io closed 1 year ago

appboy-io commented 1 year ago

Currently trying to search my collection of users using the "username" as the filter. This is my method call: pb.collection("users").getFullList(filter: 'username=$value')

This leads to a stacktrace that shows the url encoding for the filter call: ClientException: {url: https://randompocket.io/api/collections/users/records?page=1&perPage=200&filter=username%3Dfriendly, isAbort: false, statusCode: 400, response: {code: 400, message: Invalid filter parameters., data: {}}, originalError: null}

If this is expected behavior, can you possibly add a gist showing how I should pass filters into this method? Thank you in advance.

ganigeorgiev commented 1 year ago

The string literals need to be single or double quoted, otherwise it will be treated as identifier. Or in other words, you can try:

pb.collection("users").getFullList(filter: 'username="$value"')