Flutter has always been one of the highly active Appwrite platforms with lots of developers already using Appwrite to power their Flutter Apps. That is why today we are especially excited to announce that our Flutter Client SDK and the Dart Server SDK have both received an upgrade to support null safety, and we have a pre-release version of both SDKs (Flutter v0.5.0-dev.1 & Dart v0.5.0-dev.1) in pub.
Get the Null Safe SDK
To use the Null Safe SDK in your project, you can use the following as a dependency in your pubspec.yaml
file.
dependencies:
appwrite: ^0.5.0-dev.1
dart_appwrite: ^0.5.0-dev.1
What is null safety?
Sound null safety allows developers to specify which variables can contain null values. This has the potential to eradicate dreaded null reference exceptions, offering guarantees in development and at runtime that types can only contain null values if the developer expressly chooses.
There's more
To properly support access to private files in the Appwrite Storage, we have updated the methods that access the file-related Storage endpoints along with the Avatars endpoint.
Now, all of the Avatars service methods return Future<Response>
instead of the previous String
. Also the Storage methods getFilePreview
, getFileView
and getFileDownload
as well return Future<Response>
instead of previous String
. With the new method signatures you can now easily integrate any Appwrite hosted images in your Flutter app with the Image.memory
widget. Below is an example of how you can load and display image preview in your Flutter Application
FutureBuilder(
future: widget.storage.getFileView(fileId: "<YOUR_FILE_ID>"),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Image.memory(snapshot.data.data);
}
if (snapshot.hasError) {
if (snapshot.error is AppwriteException) {
print((snapshot.error as AppwriteException).message);
}
print(snapshot.error);
}
return CircularProgressIndicator();
},
),
We would love your help in testing the dev releases of both SDKs and provide us with feedback on how we can improve it further. We are excited to see what you build with Flutter 2.0 & Appwrite.
Learn More
Appwrite has many services and tools to allow you to build applications in a much more productive and secure way. You can use the following resources to learn more about Appwrite and how to leverage it in building your next Appwrite + Flutter project:
- π Getting Started Tutorial
- π Appwrite Docs
- π¬ Discord Community
- π Appwrite Flutter Playground
- βDemo - Quiz With Flutter
Don't forget to join the Appwrite Discord community, where you can learn more about Appwrite, get the latest updates, and get light-speed help with any question you might have.
Top comments (0)