DEV Community

loading...
Cover image for Announcing the Appwrite SDK for Dart
Appwrite

Announcing the Appwrite SDK for Dart

Damodar Lohani
・3 min read

We are extremely happy to announce the release of the Appwrite SDK for Dart.

This SDK joins other SDKs, such as the Node, Deno and PHP server-side SDKs that allow you to extend your Appwrite functionality from your backend.

Note, this is a Dart server side SDK, if you are looking for Flutter integration, please checkout our SDK for Flutter and the official Playground for Flutter.

What is Dart?

Made by Google, Dart is a client-optimized language for fast applications on any platform. Dart compiles to ARM & x64 machine code for mobile, desktop and backend. Or compile to JavaScript for the web. Dart is also one of the fastest growing languages.

What Is Appwrite?

In case you’re new to Appwrite, Appwrite is a new open-source, end-to-end, backend server for front-end and mobile developers that allows you to build apps much faster. Its goal is to abstract and simplify common development tasks behind REST APIs and tools, helping you to build advanced apps faster.

Getting Started

Install Appwrite

The easiest way to start running your Appwrite server is by running our Docker installer tool from your terminal. Before running the installation command, make sure you have Docker CLI installed on your host machine.

Unix

docker run -it --rm \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
    --entrypoint="install" \
    appwrite/appwrite:0.7.0
Enter fullscreen mode Exit fullscreen mode

Windows (CMD)

docker run -it --rm ^
    --volume //var/run/docker.sock:/var/run/docker.sock ^
    --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
    --entrypoint="install" ^
    appwrite/appwrite:0.7.0
Enter fullscreen mode Exit fullscreen mode

Windows (PowerShell)

docker run -it --rm ,
    --volume /var/run/docker.sock:/var/run/docker.sock ,
    --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ,
    --entrypoint="install" ,
    appwrite/appwrite:0.7.0
Enter fullscreen mode Exit fullscreen mode

Grab the Dart SDK

If you don't know Dart yet, you can find it here.

Add Appwrite SDK to your project’s pubspec.yaml file.

dependencies:
  dart_appwrite: ^0.1.0
Enter fullscreen mode Exit fullscreen mode

Then get the dependencies by running

dart pub get
Enter fullscreen mode Exit fullscreen mode

Initialize & Make API Request

Once you add the dependencies, its extremely easy to get started with the SDK; All you need to do is import the package in your code, set your Appwrite credentials, and start making API calls. Below is a simple example:

import 'package:dart_appwrite/dart_appwrite.dart';

void main() async {
  Client client = Client();
  .setEndpoint(
          'http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible
      .setProject('5ff3379a01d25') // Your project ID
      .setKey('cd868c7af8bdc893b4...93b7535db89')
  Users users = Users(client);
  final response = await users.create(email: email@example.com,password: password, name: name);
  print(response.data);
}
Enter fullscreen mode Exit fullscreen mode

Cloud Functions

Recently released Appwrite 0.7, has support for Dart cloud functions, and the Appwrite Dart SDK can be used to write cloud functions for Appwrite. To learn how to create and run Appwrite Functions with Dart, please head over to our tutorial. You can find samples for Dart cloud functions in Appwrite's Github Repository.

Docs and Examples

To learn more about how to use the new Dart SDK, You can visit the Getting Started With Server section on the official Appwrite documentation where you can select Dart in the code examples. We have also released a new dedicated Dart Playground repository with useful code examples that can help you get a good look and feel for how you can use the new SDK for Appwrite.

Discussion (1)

Collapse
mysticaltech profile image
K. N.

Very hot, keep up the good work folks! And docker support means Kubernetes support, which can make your app scalable, that is absolutely fantastic!