I have an issue with how flutterflow is handling a supabase api query. Any suggestions would be very much appreciated.
Problem
It seems to be failing because it is calling toList() on a null value.
However, it should not need to call toList(). It does this even if I am not using that json path at all in the app.
The Test Response works. There's no problem with the query.
The app works if I remove the join that yields the array on the json path. There is no dependency yet.
API Query
https://12345678.supabase.co/rest/v1/reviews_feed?
select=*,
reviews_bookmarks!review_bookmarks_review_id_fkey(user_id,review_id)
&reviews_bookmarks.user_id=eq.[userID]
&order=id.desc
Test Response (it works)
Notice that some reviews have 1 bookmark. Some have zero.
{
"id": 33,
"review": "Cool",
"username": "bot bot",
"user_id": "5282058",
"reviews_bookmarks": []
},
{
"id": 32,
"review": "beep",
"username": "not a bot",
"user_id": "5282058",
"reviews_bookmarks": [
{ "user_id": "6f9c13e4-b1be-4edd-915b-2e8d7472ceea" }
]
},
Error
nosuchmethoderror: 'toList'
Dynamic call of null.
Receiver instance of '_JsonMap'
Arguments: []
Fixes
My goal is know which reviews the current user has bookmarked. The query filters bookmarks to the current user, so the array always has 1 or zero elements. Never more. I only need to check if the path has data or is null.
One fix would be to understand why flutterflow is calling toList() and prevent that.
Another fix would be to adjust my query so that the json doesn't have an array, since I don't need that.
Any advice would be very much appreciated.