Supabase Data Types Custom Action

Hi!

I'm trying to use Data Types, but I have a problem with expected value of type.

I use custom action to get customer list from supabase and everything works fine.

Future<List<dynamic>?> searchClients(String searchField) async {
  // Add your function code here!
  final supabase = SupaFlow.client;
  final response = await supabase
      .from('clients')
      .select()
      .ilike('clients_all_columns', '%${searchField}%')
      .limit(10)
      .order('created_at', ascending: false);

  return response;
}

I changed it to use Data Types and now it looks like this

Future<List<ClientsStruct>?> searchClients2(String searchField) async {
  // Add your function code here!
  final supabase = SupaFlow.client;
  final response = await supabase
      .from('clients')
      .select()
      .ilike('clients_all_columns', '%${searchField}%')
      .limit(10)
      .order('created_at', ascending: false);

  return response;
}

Unfortunately I am not receiving the data. There is such an error in the console

dart_sdk.js:5402 Uncaught (in promise) Error: Expected a value of type 'FutureOr<List<ClientsStruct>?>', but got one of type 'List<dynamic>'

Anyone have an idea how to fix this? Thank you!

2
1 reply