appwrite/docs/examples/0.8.x/client-flutter/examples/storage/get-file-view.md
2021-05-18 22:05:44 +03:00

738 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 .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token ; }

//displaying image FutureBuilder( future: storage.getFileView( 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.data, ) : CircularProgressIndicator(); }, );