0

VS Code says that .execute isn't defined for the type 'PostgrestFilterBuilder'.

Here is my Code:

text_service.dart

import 'package:thrive/main.dart';

class TextService {
  Future<List<String>> fetchTexts() async {
    final response = await supabase
        .from('profiles')
        .select('community')
        .execute();

    if (response.error != null) {
      throw response.error!;
    }

    final data = response.data as List<dynamic>;
    return data.map((item) => item['community'] as String).toList();
  }
}

I tried to use .get instead of .execute but this also doesn't work. Can someone help me?

1 Answer 1

0

In the latest Supabase SDK versions, the ".execute()" method has been deprecated. Instead, you could directly use the PostgrestFilterBuilder object to fetch data.

`import 'package:thrive/main.dart';

class TextService {
  Future<List<String>> fetchTexts() async {
    final response = await supabase
        .from('profiles')
        .select('community');

    if (response != null) {
      throw response;
    }

    final data = response as List<dynamic>;
    return data.map((item) => item['community'] as String).toList();
  }
}`
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.