Dart client library to interact with Supabase Storage

Overview

storage-dart

Dart client library to interact with Supabase Storage.

pub package pub test

Contributing

  • Fork the repo on GitHub
  • Clone the project to your own machine
  • Commit changes to your own branch
  • Push your work back up to your fork
  • Submit a Pull request so that we can review your changes and merge

License

This repo is licensed under MIT.

Credits

Comments
  • feat: add retry on file upload failure when offline

    feat: add retry on file upload failure when offline

    What kind of change does this PR introduce?

    Uploading large files on a spotty connection could be tough.

    Resumable uploads is not yet supported on Supabase, but we can easily implement retries. This PR adds a retry logic to file uploads in a exponentially backing off manner like the following:

    1. 400 ms +/- 25%
    2. 800 ms +/- 25%
    3. 1,600 ms +/- 25%
    4. 3,200 ms +/- 25%
    5. 6,400 ms +/- 25%
    6. 12,800 ms +/- 25%
    7. 25,600 ms +/- 25%
    8. and beyond 30,000 ms +/- 25%

    By default, the max attempts is set to 25, which should be roughly 10 minutes. 10 minutes was the default time set for Firebase storage. Users can change the retry count like the following. Not sure if this API would provide the best developer experience, so would love to hear comments/ suggestions about anything regarding this PR!

    final uploadTask =
        client.from('public').upload('a.txt', file, maxAttempts: 8);
    

    What is the current behavior?

    If a file upload fails, it does no retry, which makes is hard to upload large files over a spotty network connection.

    What is the new behavior?

    File upload is automatically retried on SocketException or TimeoutException.

    Additional context

    This feature is not supported on JS client, but there was an feedback from customers handling large files. After some internal discussions, we thought it would make make sense to add this feature to the Flutter SDK.

    opened by dshukertjr 15
  • support Uint8List in uploadBinary

    support Uint8List in uploadBinary

    I have the following code:

    FilePickerResult? result = await FilePicker.platform.pickFiles();
    if (result != null) {
        Uint8List? fileBytes = result.files.first.bytes;
    }
    

    In Firebase, I could call FirebaseStorage.instance.ref('uploads/$fileName').putData(fileBytes); In Supabase...? There is uploadBinary which receives a BinaryFile(!?) with the mime and the bytes. Should I call result.toInt()? Isn't that just boilerplate? Or is there a better way?

    documentation 
    opened by bernaferrari 10
  • Add doc

    Add doc

    Bug report

    Describe the bug

    Hello team , Please add any documentation or any comment . I am unable to understand which url & header you need for this. Make an example and clear that.

    bug 
    opened by Xnayak 7
  • feat: custom http client

    feat: custom http client

    Motivation

    Same reason as https://github.com/supabase-community/postgrest-dart/pull/66

    Implementation

    Instead of passing the httpClient down to the api, I replaced the global fetch, because tests use the global variable to mock Fetch. I think this pattern is very uncommon, but I didn't want to rewrite all tests.

    opened by Vinzent03 6
  • feat: set custom mime/Content-Type

    feat: set custom mime/Content-Type

    What kind of change does this PR introduce?

    Adds mime to FileOptions, which enables the dev to set custom Content-Type

    What is the current behavior?

    Binary upload/update misses custom Content-Type, which causes missing preview in for example Supabase dashboard

    What is the new behavior?

    The dev can specify a custom Content-Type.

    Additional context

    The Content-Type in _handleBinaryFileRequest was previously gotten from _parseMediaType(url), which I think makes no sense, because the url has nothing to do with the new file itself.

    opened by Vinzent03 6
  • Fix/types

    Fix/types

    I'm hiding FetchOptions, because it causes a duplication with postgrest-dart when exported in supabase-dart. It's only used internally, nevertheless. ~~I'm renaming StorageException to StorageError, because the other classes like GoTrueError and PostgrestError are named like this as well.~~ Just to mention, the migration note in CHANGELOG.md is wrong, because it uses StorageError

    opened by Vinzent03 5
  • Breaking: Update type of `metadata` to  Map<String, dynamic>

    Breaking: Update type of `metadata` to Map

    Following the update in JS SDK https://github.com/supabase/storage-js/pull/90

    Also I added a List files test, because there were no test methods using FileObject.

    Fixes https://github.com/supabase-community/supabase-flutter/issues/178

    opened by dshukertjr 4
  • App not compiling for the Flutter Web

    App not compiling for the Flutter Web

    I am building a Flutter app using a Supbase, I am getting an issue while building app for the Web.

    Below error what I got

    Launching lib/main.dart on Chrome in debug mode...
    Waiting for connection from debug service on Chrome...
    lib/screen/dashboard/profile/store/profile_screen_store.dart:166:43: Error: The argument type 'File/*1*/' can't be assigned to the parameter type 'File/*2*/'.
     - 'File/*1*/' is from 'dart:io'.
     - 'File/*2*/' is from 'package:universal_io/src/io/file.dart' ('../../../../.pub-cache/hosted/pub.dartlang.org/universal_io-2.0.4/lib/src/io/file.dart').
                .update('$fileName$imageExt', file);
                                              ^
    lib/screen/dashboard/profile/store/profile_screen_store.dart:170:43: Error: The argument type 'File/*1*/' can't be assigned to the parameter type 'File/*2*/'.
     - 'File/*1*/' is from 'dart:io'.
     - 'File/*2*/' is from 'package:universal_io/src/io/file.dart' ('../../../../.pub-cache/hosted/pub.dartlang.org/universal_io-2.0.4/lib/src/io/file.dart').
                .upload('$fileName$imageExt', file);
                                              ^
    Failed to compile application.
    
    

    Link to Source code

    profile_screen_store

    bug 
    opened by ibhavikmakwana 4
  • feat: image transform support

    feat: image transform support

    What kind of change does this PR introduce?

    New image transformation feature will be added to Supabase. This PR adds support for that feature.

    • transform option has been added to getPublicUrl and createSignedUrl methods.
    • download method has been deprecated in favor of publicDownload and authenticatedDownload methods.

    supabase-js code here https://github.com/supabase/storage-js/pull/129

    What is the current behavior?

    Image transform is not supported

    What is the new behavior?

    Image transform feature is supported where images stored on Supabase storage can be resized on the fly.

    We will hold off on merging this until this PR is merged on storage-js.

    opened by dshukertjr 2
  • feat: add link to the Dart doc

    feat: add link to the Dart doc

    What kind of change does this PR introduce?

    Adds a link to the Dart doc for storage.

    Closes https://github.com/supabase/storage-dart/issues/1

    What is the current behavior?

    There are no doc or link to any docs in the repo.

    What is the new behavior?

    Users can navigate themselves to the official doc.

    opened by dshukertjr 2
  • Storage rework

    Storage rework

    Part of https://github.com/supabase-community/supabase-dart/issues/109

    • Now errors should be handled inside of a try/catch block
    • Added StorageFileApi.copy and StorageFileApi.createSignedUrls
    • Renamed fetch to storageFetch, in order to avoid conflicts between other supabase libraries
    • Improved documentation on methods that already had docs
    • Added lints for linting
    opened by bdlukaa 1
Owner
Supabase
Supabase
A Dart client for Supabase

supabase-dart A Dart client for Supabase. What is Supabase Supabase is an open source Firebase alternative. We are a service to: listen to database ch

Supabase Community 392 Jan 7, 2023
The deta-dart library is the simple way to interact with the services of the free clud on the Deta plataform.

Deta A Dart package to interact with the HTTP API of the free services of the Deta plataform. ?? WARNING ?? This client should only be used on the ser

Yeikel Uriarte Arteaga 6 May 2, 2022
UI library to easily implement auth functionalities of Supabase in your app.

flutter-auth-ui A simple library of predefined widgets to easily and quickly create a auth compooents using Flutter and Supabase. ⚠️ Developer Preview

Supabase Community 20 Dec 13, 2022
A dart package to interact with the WooCommerce REST API.

WooCommerce SDK for Dart A dart package to interact with the WooCommerce API (now with null-safety). It uses OAuth1.0a behind the scenes to generate t

Samarth Agarwal 87 Dec 28, 2022
Addons to supabase dart (and Flutter), to make development easier.

supabase_addons Make great apps with a great backend! Supabase is an open source Firebase alternative. It has support for auth, database and storage u

Bruno D'Luka 20 Dec 3, 2022
Tezart helps to interact with ​Tezos blockchain.

Tezart What it is Tezart is a Dart library for building decentralized applications on Tezos blockchain. Tezart interacts with a Tezos node to send tra

MoneyTrack 21 Dec 14, 2022
A simple and robust way to interact with Anilibria API.

anilibria.dart A simple and robust way to interact with Anilibria API. Example import 'package:anilibria/anilibria.dart'; void main() async { final

Arsenii Liunsha 3 Jun 13, 2022
meg4cyberc4t 11 Oct 24, 2022
A highly customizable Flutter widget to render and interact with JSON objects.

The spreadsheet with superpowers ✨ ! JSON Data Explorer A highly customizable widget to render and interact with JSON objects. Features Expand and col

rows 15 Dec 21, 2022
Git+ is your ultimate GitLab mobile app that lets you interact with your projects like as if you were using desktop.

Git+ for GitLab Git+ is your ultimate GitLab mobile app that lets you interact with your projects like as if you were using desktop. Git+ lets you see

Marek Gvora 38 Jan 7, 2023
Open source Flutter-based GUI application that enables you to interact with Amphitheatre

Amphitheatre Desktop Amphitheatre Desktop is an open source Flutter-based application that enables you to interact with Amphitheatre using a GUI inste

Amphitheatre 17 Dec 16, 2022
Flutter integration for Supabase. This package makes it simple for developers to build secure and scalable products.

supabase_flutter Flutter package for Supabase. What is Supabase Supabase is an open source Firebase alternative. We are a service to: listen to databa

Supabase 251 Jan 7, 2023
🎯 A powerful multiplatform application with Flutter and Supabase for the Komentory project.

?? Multiplatform application for Komentory project A powerful multiplatform application with Flutter and Supabase for the Komentory project. Currently

Komentory 3 Mar 1, 2022
A Flutter application to plan personal activities and routines that uses Supabase for the backend.

Flutter Planner Generated by the Very Good CLI ?? A Flutter application to plan personal activities and routines that uses Supabase for the backend. P

Ivan 15 Dec 29, 2022
A Flutter mobile application built completely using DhiWise and Supabase without coding single line of code. With 100% system generated code

Flutter Expension Getting Started with Flutter ?? Generated with ❤️ from Dhiwise A Flutter mobile application built completely using DhiWise and Supab

DhiWise 11 Oct 23, 2022
An example Flutter application built with Very Good CLI and Supabase 🦄

Supabase Example Generated by the Very Good CLI ?? An example Flutter application built with Very Good CLI and Supabase ?? Getting Started ?? This pro

Very Good Ventures 46 Dec 27, 2022
A fully functional Furniture App Clone made using Flutter, Supabase and Getx State Management.

?? Flutter Furniture App ?? Timberr is a fully functional Furniture App Clone Developed using Flutter, Supabase and Getx State Management which is bas

Aditya 54 Nov 22, 2022
This is an example project for the article about implementing clean architecture in flutter with riverpod and supabase as backend service.

The Example This is an example how to implement clean architecture with domain driven design and riverpod in flutter projects. Getting Started Rename

Volodymyr Hodiak 45 Dec 30, 2022