fetch<T> method

Future<T> fetch<T>({
  1. required SupaModifier<B, R, T, PostgrestBuilder, PostgrestBuilder> modifier,
  2. SupaFilter<B>? filter,
  3. Set<SupaColumnBase<B>>? columns,
})

Fetches records from the Supabase table.

columns: The set of columns to fetch. If null, all columns are fetched.

filter: The filter to apply to the query.

modifier: The modifier to apply to the query.

Implementation

Future<T> fetch<T>({
  required SupaModifier<B, R, T, PostgrestBuilder<dynamic, dynamic, dynamic>,
          PostgrestBuilder<dynamic, dynamic, dynamic>>
      modifier,
  SupaFilter<B>? filter,
  Set<SupaColumnBase<B>>? columns,
}) async {
  final request = supabaseClient
      .schema(schema)
      .from(tableName)
      .select(_generateColumnsPattern(columns));

  dynamic response;

  if (filter != null) {
    response =
        await request.supaApplyFilter(filter).supaApplyModifier(modifier);
  } else {
    response = await request.supaApplyModifier(modifier);
  }

  return _castResponse(modifier, response);
}