Flutter: Upload a file

Uploads a file to an existing bucket.

Examples

Upload file

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

Upload file on web

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