Title: Query Params Do Not Support Multiple Filters on the Same Key (e.g. `created_at=gte...&created_at=lte...`) · Issue #296 · flutterdata/flutter_data · GitHub
Open Graph Title: Query Params Do Not Support Multiple Filters on the Same Key (e.g. `created_at=gte...&created_at=lte...`) · Issue #296 · flutterdata/flutter_data
X Title: Query Params Do Not Support Multiple Filters on the Same Key (e.g. `created_at=gte...&created_at=lte...`) · Issue #296 · flutterdata/flutter_data
Description: Description: I'm encountering an issue where query parameters do not support multiple filters on the same key when using array values. For example, filtering with: created_at=gte.2025-04-03&created_at=lte.2025-04-05 is a common pattern i...
Open Graph Description: Description: I'm encountering an issue where query parameters do not support multiple filters on the same key when using array values. For example, filtering with: created_at=gte.2025-04-03&created...
X Description: Description: I'm encountering an issue where query parameters do not support multiple filters on the same key when using array values. For example, filtering with: created_at=gte.2025-04-03&...
Opengraph URL: https://github.com/flutterdata/flutter_data/issues/296
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Query Params Do Not Support Multiple Filters on the Same Key (e.g. `created_at=gte...&created_at=lte...`)","articleBody":"**Description:**\n\nI'm encountering an issue where query parameters do not support multiple filters on the same key when using array values. For example, filtering with:\n\n```\ncreated_at=gte.2025-04-03&created_at=lte.2025-04-05\n```\n\nis a common pattern in PostgREST to filter by a range, but the library currently fails to handle this correctly.\n\n---\n\n**Reproduction Code:**\n\n```dart\nref.expenseEntities.findAll(params: {\n 'created_at': ['gte.2025-04-03', 'lte.2025-04-05']\n});\n```\n\n**Decoded URL:**\n\n```\ncreated_at=[gte.2025-04-03,+lte.2025-04-05]\n```\n\n---\n\n**Error from PostgREST:**\n\n```\nunhandled Exception: DataException: \n{\n code: PGRST100,\n details: unexpected \"[\" expecting \"not\" or operator (eq, gt, ...),\n message: \"failed to parse filter ([gte.2025-04-03, lte.2025-04-05])\"\n}\n```\n\n---\n\n**Temporary Workaround:**\n\nI resolved this by manually constructing the URI to ensure repeated keys are supported:\n\n```dart\nfinal parseUri = Uri.parse(baseUrl);\nfinal uri = parseUri.replace(\n path: '${parseUri.path}/${urlForFindAll(params)}'.replaceAll('//', '/'),\n queryParameters: params,\n);\nsendRequest\u003cList\u003cT>>(\n uri,\n method: methodForFindAll(params),\n headers: headers,\n label: label,\n);\n```\n\nThis works for now, but it feels like a workaround rather than a clean solution. Ideally, the library should support multiple filters for the same key in a proper way compatible with PostgREST.\n\n---\n\n**Expected Behavior:**\n\nThe library should generate query strings with repeated keys when array values are provided in the `params`, like:\n\n```\n...?created_at=gte.2025-04-03&created_at=lte.2025-04-05\n```\n\n---\n\n**Additional Notes:**\n\nLet me know if I’m missing a proper way to handle this use case within the current API. Otherwise, I hope this can be improved in a future release!\n\n","author":{"url":"https://github.com/putheng","@type":"Person","name":"putheng"},"datePublished":"2025-05-03T04:07:54Z","url":"https://github.com/flutterdata/flutter_data/issues/296"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a3c843f8-7a9d-4591-9636-96a230366a16 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBC0:11486D:6CDC19:8F2866:6B00D49B |
| html-safe-nonce | 1bcac83e6848c3d4d464f9e51063f0e55e92bd5a09b20f74ef399ebbd7ae668e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkMwOjExNDg2RDo2Q0RDMTk6OEYyODY2OjZCMDBENDlCIiwidmlzaXRvcl9pZCI6IjIyNDkxMTM3OTQ0NzMxNTM2OTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6d01a9e69896e3c7890c4d37c1aabd95ef246e7f24012f333263baf11c6c1b6f |
| hovercard-subject-tag | issue:3037148973 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/flutterdata/flutter_data/296/issue_layout |
| twitter:image | https://opengraph.githubassets.com/34387db952ed8d69839c8442507656288c63315d56d6c0cf19f6c7594caf42d0/flutterdata/flutter_data/issues/296 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/34387db952ed8d69839c8442507656288c63315d56d6c0cf19f6c7594caf42d0/flutterdata/flutter_data/issues/296 |
| og:image:alt | Description: I'm encountering an issue where query parameters do not support multiple filters on the same key when using array values. For example, filtering with: created_at=gte.2025-04-03&created... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | putheng |
| hostname | github.com |
| expected-hostname | github.com |
| None | a481f62a1e04c9b9bdcb5628230682c66d59006f5b13b080f79cba84a176905b |
| turbo-cache-control | no-preview |
| go-import | github.com/flutterdata/flutter_data git https://github.com/flutterdata/flutter_data.git |
| octolytics-dimension-user_id | 61839689 |
| octolytics-dimension-user_login | flutterdata |
| octolytics-dimension-repository_id | 246649621 |
| octolytics-dimension-repository_nwo | flutterdata/flutter_data |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 246649621 |
| octolytics-dimension-repository_network_root_nwo | flutterdata/flutter_data |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 84c8c5cc25e2fb7f2308428458538436baecc6d2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width