stripNulls method

PostgrestTransformBuilder<T> stripNulls()

Omits null-valued properties from the response objects.

This uses the nulls=stripped variant of the Accept header and requires PostgREST 11.2 or higher.

supabase.from('users').select().stripNulls();

Implementation

PostgrestTransformBuilder<T> stripNulls() {
  final newHeaders = {..._headers};
  final accept = newHeaders['Accept'] ?? 'application/json';
  newHeaders['Accept'] = '$accept;nulls=stripped';

  return PostgrestTransformBuilder(_copyWith(headers: newHeaders));
}