I want to filter a supabase table - Code generated by AI this wont compile,

I want to filter a supabase table - Code generated by AI this wont compile, i have used my supabase url and anon key, and used it in a custom function - need help urgently Thanks

created by import 'dart:convert';

import 'dart:math' as math;

import 'package:flutter/material.dart';

import 'package:google_fonts/google_fonts.dart';

import 'package:intl/intl.dart';

import 'package:timeago/timeago.dart' as timeago;

import '/flutter_flow/lat_lng.dart';

import '/flutter_flow/place.dart';

import '/flutter_flow/uploaded_file.dart';

import '/flutter_flow/custom_functions.dart';

import '/backend/supabase/supabase.dart';

List<String>? filterSupabasetable() {

/// MODIFY CODE ONLY BELOW THIS LINE

Future<List<Map<String, dynamic>>> filterSupabasetable(

String lastname) async {

final client = SupabaseClient('MY SUPABASE CLIENT',

'MY ANON KEY');

final response = await client

.from('clientmain')

.select()

.eq('lastname', lastname)

.execute();

if (response.error != null) {

print('Error fetching records: ${response.error?.message}');

return [];

}

return List<Map<String, dynamic>>.from(response.data as List);

}

// Use this function in a Flutter widget to get and display the data

/// MODIFY CODE ONLY ABOVE THIS LINE

}

2
25 replies