Closed DanMossa closed 2 years ago
If I have
final Supabase _supabase = Supabase.instance; static final _users = _supabase.client.from('users'); static Future<UserModel?> getUser(String userId, [String columns = '*']) async { final PostgrestResponse res = await _users.select(columns) .eq('user_id', userId) .maybeSingle() .execute(); } static Future<List<UserModel>> getMatchingUsers(UserModel callingUser, [String columns = "*"]) async { final PostgrestResponse res = await _users.select(columns) .execute(); }
And I first call getUser, then this line is hit
getUser
headers['Accept'] = 'application/vnd.pgrst.object+json';
If I then call anything else, such as getMatchingUsers, an error occurs because more than 1 row is returned.
getMatchingUsers
I'm dumb and I shouldn't have reused static final _users = _supabase.client.from('users');
static final _users = _supabase.client.from('users');
If I have
And I first call
getUser
, then this line is hitIf I then call anything else, such as
getMatchingUsers
, an error occurs because more than 1 row is returned.