Introducing Sound Null Safety Support for Appwrite Flutter and Dart SDKs
Tags: appwrite, dart, flutter, nullsafety
Published: 2021-04-21 13:06:00

Flutter has always been one of the highly active [Appwrite](https://appwrite.io) 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](https://pub.dev/packages/appwrite/versions/0.5.0-dev.1) and the [Dart Server SDK](https://pub.dev/packages/dart_appwrite/versions/0.5.0-dev.1) 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](https://pub.dev).

## 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.
```dart
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

```dart
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](https://appwrite.io/docs/getting-started-for-flutter)
- 📜 [Appwrite Docs](https://appwrite.io/docs)
- 💬 [Discord Community](https://appwrite.io/discord)
- 🚂 [Appwrite Flutter Playground](https://github.com/appwrite/playground-for-flutter)
- ❓[Demo - Quiz With Flutter](https://github.com/appwrite/quiz-with-flutter)

Don't forget to join the [Appwrite Discord community](https://appwrite.io/discord), where you can learn more about Appwrite, get the latest updates, and get light-speed help with any question you might have.