from.update()

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

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

Notes#

  • Policy permissions required:
    • buckets permissions: none
    • objects permissions: update and select

Examples#

Update file#

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