Code Monkey home page Code Monkey logo

storage-dart's Introduction

storage-dart

Warning This repository has been moved to the supabase-flutter repo.

Dart client library to interact with Supabase Storage.

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

storage-dart's People

Contributors

bdlukaa avatar ben1980 avatar dshukertjr avatar dsyrstad avatar hadi-codes avatar illyism avatar phamhieu avatar vinzent03 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

storage-dart's Issues

Storage GET requests are rejected by AWS CloudFront

Background: We have supabase storage running on AWS. All requests are fronted by CloudFront.

When I make a request to get a bucket:

    final getResponse = await supabaseClient.storage.getBucket(bucketName);

CloudFront rejects the request with HTTP 403. It turns out it's because this is a GET request and the Storage API is issuing the request with a body of "{}" (text-plain). CloudFront does not allow a body on GET requests. These lines appear to be problematic:

https://github.com/supabase-community/storage-dart/blob/main/lib/src/fetch.dart#L56
https://github.com/supabase-community/storage-dart/blob/main/lib/src/fetch.dart#L152

GET requests shouldn't have bodies anyway.

I will try to raise a PR to fix this issue.

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

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?

Support upload with upsert

Feature request

Is your feature request related to a problem? Please describe.

I want to upload/update profile images. They are named by the user id. If the file already exists, an upload fails, so an update is necessary. But an update fails if the file doesn't exist yet. As stated in the docs there is an option to enable upsert for an upload.

Describe the solution you'd like

Add upsert option to FileOptions

Describe alternatives you've considered

Additional context

When using upload when the file already exists, the following error is thrown:
duplicate key value violates unique constraint "bucketid_objname"

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.