I'm trying to run a function in Supabase with the following code, but without success:
// Automatic FlutterFlow imports
import '/backend/schema/structs/index.dart';
import '/backend/supabase/supabase.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'dart:convert';
import 'package:supabase/supabase.dart';
//String api_url = (FFAppState().supabaseApiURL).replaceAll(' ', '');
//String api_anon = (FFAppState().supabaseApiAnon).replaceAll(' ', '');
//api_url = api_url.trim();
Future<UsersRow?> consultarUser2(String? userId) async {
final supabase =
SupabaseClient(FFAppState().supabaseApiURL, FFAppState().supabaseApiAnon);
//SupabaseClient.instance;
final response = await supabase.rpc('getuserbyid', params: {'_id': userId});
if (response.error != null) {
// Handle error
print(response.error!.message);
//return {};
}
return UsersRow(response.data!);
}
Any suggestion?
Function Supabase API - Custon Action
1
18 replies