Null check operator used on a null value
carlomigueldy opened this issue · 5 comments
Bug report
Describe the bug
When I query from a table "servers", it returns 500. I think this is coming from the SupabaseClient
{data: null, status: 500, error: {message: Null check operator used on a null value, details: null, hint: null, code: _CastError}, count: null}
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Create a Flutter project and a Supabase project
- Configure the Flutter project that will interact with the Supabase project (Setup SUPBASE_URL and SUPABASE_SECRET)
- Read records from any table of your Supabase project
{data: null, status: 500, error: {message: Null check operator used on a null value, details: null, hint: null, code: _CastError}, count: null}
Expected behavior
It should return me an array of JSON objects. And status code of 200
and not 500
.
Screenshots
This is my supabase client setup
This is my query from an abstract class, then my ServerService
class extends from it.
Then here is where I trigger the call to Supabase API
Tap and call method
System information
- OS: Windows
- Version of supabase-dart: 0.0.1-dev.11
- Version of Node.js: [e.g. 10.10.0]
Flutter doctor
Additional context
In case you might need to see it for yourself, here is my repository link. https://github.com/carlomigueldy/flutter-web-discord-clone
I love supabase since it is a serverless and uses Postgres, I love relational databases :) So thanks for creating that decision instead of going NoSQL.
I cloned your project and I'm getting the same error message. It looks like an exception is thrown in the postgrest
package on this line.
And indeed, method
on this line is a String?
that is never initialised, which throws when calling method!
. This could be solved by marking method
as required
in PostgrestBuilder
's constructor or by putting a default value (like "get"
for example), not sure what's best.
Actually the issue is that you called .execute()
directly on from("servers")
. There is no query to execute. Try replacing
final response = await Supabase.client.from("public").execute();
with
final response = await Supabase.client.from("public").select().execute();
Still this is a bit confusing. It should either not be possible to call execute()
directly, or it should return a more explicit error.
Will close the issue now.
If this supabase/postgrest-dart@5f6e140 gets merged then would also be great