Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 Feature: Method to Generate File URL #71

Open
2 tasks done
Tracked by #557
stnguyen90 opened this issue Jul 15, 2022 · 2 comments
Open
2 tasks done
Tracked by #557

馃殌 Feature: Method to Generate File URL #71

stnguyen90 opened this issue Jul 15, 2022 · 2 comments
Assignees

Comments

@stnguyen90
Copy link

馃敄 Feature description

Add storage.getFileDownloadURL(), storage.getFilePreviewURL(), and storage.getFileViewURL() methods.

馃帳 Pitch

There are instances where it would be helpful to get a URL rather than the file as bytes such as when used by Image.network() or on Flutter Web.

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@silvinhodev
Copy link

Don't is necessary only a method to get URL?

@silvinhodev
Copy link

silvinhodev commented Jul 21, 2022

How I have mentioned in discord, I forked this project now, i have updated the method 'getFileView' and make fews changes to obtain a url in same method.
So then, storage.getFileView(), storage.getFilePreview() and storage.getFileDownload() can obtain a URL and show a Image with widget Image.network().

And bonus, a method to get a URL passing bucketId and fileId outside methods above.

Example:

FutureBuilder(
  future: Services.instance.storage.getFileView(
    bucketId: '62d5a2b48e1af6936615',
    fileId: '62d5a2cdf08aa4f45e6e',
    getURL: true, //Set getURL to [true] to obtain a URL Link,
                  //if set to [false] or remove it obtain a [Uint8List].
  ),
  builder: (context, snapshot) {
    if (!snapshot.hasData) {
      return const Center(
        child: CircularProgressIndicator(),
      );
    }
    return Column(
      children: [
        const Text(
          'Obtain a url with getURL',
          style: TextStyle(fontWeight: FontWeight.bold),
        ),
        const SizedBox(height: 10),
        Text(
          '${snapshot.data}',
        ),
        const SizedBox(height: 10),
        const Text(
          'Obtain a url with getURL and show'
          ' a image using Image.network()',
          style: TextStyle(fontWeight: FontWeight.bold),
        ),
        const SizedBox(height: 10),
        Image.network('${snapshot.data}'),
      ],
    );
  },
),

Captura de Tela 2022-07-21 a虁s 09 56 36
Captura de Tela 2022-07-21 a虁s 09 56 56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants