appwrite/docs/examples/0.13.x/client-flutter/examples/storage/get-file-preview.md
2022-03-02 12:17:57 +01:00

676 B

import 'package:appwrite/appwrite.dart';

void main() { // Init SDK Client client = Client(); Storage storage = Storage(client);

client .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; }

//displaying image FutureBuilder( future: storage.getFilePreview( bucketId: '[BUCKET_ID]', fileId: '[FILE_ID]', ), //works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null ? Image.memory( snapshot.data, ) : CircularProgressIndicator(); }, );