Flutter: Replace an existing file

Replaces an existing file at the specified path with a new one.

Parameters

Examples

Update file

final avatarFile = File('path/to/local/file');
final String path = await supabase.storage.from('avatars').update(
      'public/avatar1.png',
      avatarFile,
      fileOptions: const FileOptions(cacheControl: '3600', upsert: false),
    );

Update file on web

final Uint8List avatarFile = file.bytes;
final String path = await supabase.storage.from('avatars').updateBinary(
      'public/avatar1.png',
      avatarFile,
      fileOptions: const FileOptions(cacheControl: '3600', upsert: false),
    );