Signed URL for Supabase storage file.

I am trying to get the signed URL working for an image in a private bucket in Supabase... I want to use a custom action and then provide the details as part of a action flow before I update the image network URL.

I wrote this code, but although it compiles, it does not work... any ideas why?

Obviously I have removed the proper supabase url and key ๐Ÿ˜„

Thanks for the help.

// Automatic FlutterFlow imports
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 'package:supabase/supabase.dart';

Future<String> getSupabaseSignedURL(String imageLink) async {
  // Add your function code here!
  const supabaseUrl = 'https://url.supabase.co';
  const supabaseKey = 'api-key';
  final supabase = SupabaseClient(supabaseUrl, supabaseKey);

  final signedURL = await supabase.storage
      .from('rmrpc-profile')
      .createSignedUrl('$imageLink', 60);
  return signedURL;
}
1
9 replies