Learn how to configure a Dart or Flutter app for use with Filebase.
What is Dart?
Dart is a programming language developed by Google that is designed for client and app development, such as desktop or mobile applications.
What is Flutter?
Flutter is an open-source user interface development kit created for use with Dart. Flutter is used to develop mobile applications for Android and iOS, and desktop applications for Linux, Mac, Windows and Google.
Read below to learn how to configure a Dart or Flutter app to be used with Filebase.
Prerequisites:
Filebase is unable to provide specific configurations or debugging for custom applications due to their individualized nature.
Initialize the MinIO Client
The following code example showcases how to initialize the MinIO Client using the minio-dart package. Replace the following values in the code to match your configuration:
accessKey: Your Filebase Access Key
secretKey: Your Filebase Secret Key
final minio =Minio( endPoint:'s3.filebase.com', accessKey:'YOUR-ACCESSKEYID', secretKey:'YOUR-SECRETACCESSKEY', useSSL:true,);
Object Upload
The following code example showcases how to upload an object using the minio-dart package. Replace the following values in the code to match your configuration:
The following code example showcases how to download an object using the minio-dart package. Replace the following values in the code to match your configuration:
accessKey: Your Filebase Access Key
secretKey: Your Filebase Secret Key
filebase-sample-bucket: Your Filebase Bucket Name
myobject: The Object Name to be downloaded.
import'dart:io';import'package:minio/minio.dart';voidmain() async {final minio =Minio( endPoint:'s3.filebase.com', accessKey:'YOUR-ACCESSKEYID', secretKey:'YOUR-SECRETACCESSKEY',);final stream =await minio.getObject('filebase-sample-bucket', 'myobject');// Get object lengthprint(stream.contentLength);// Write object data stream to fileawait stream.pipe(File('output.txt').openWrite());}
Full Example
The following code example showcases a complete code example using the minio-dart package. Replace values as necessary to match your configuration.