Skip to main content

dart_appwrite 31.0.0 copy "dart_appwrite: ^31.0.0" to clipboard
dart_appwrite: ^31.0.0 copied to clipboard

Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API

Appwrite Dart SDK #

pub package License Version X Account Discord

This SDK targets Appwrite server version 2.5.x as shipped on Appwrite Cloud. Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from previous releases when APIs differ.

This is the Dart SDK for integrating with Appwrite from your Dart server-side code. If you're looking for the Flutter SDK you should check appwrite/sdk-for-flutter

Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Dart SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to https://appwrite.io/docs

Appwrite

Installation #

Add the package from the command line:

dart pub add dart_appwrite

Or add it to your package's pubspec.yaml file and run dart pub get:

dependencies:
  dart_appwrite: ^31.0.0

Getting Started #

Initialize the client #

Import the package and point the client at your project. Server code authenticates with an API key, which you create in the Appwrite Console with the scopes your code needs. Keep the key on the server and never ship it in a client app.

import 'package:dart_appwrite/dart_appwrite.dart';

Client client = Client()
    .setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
    .setProject('<YOUR_PROJECT_ID>')
    .setKey('<YOUR_API_KEY>');

If you self-host Appwrite, use your instance's endpoint instead, for example https://appwrite.example.com/v1. Call setSelfSigned() only in development, when the instance uses a self-signed certificate.

To act on behalf of a user instead of with an API key, pass the user's JWT with setJWT('<JWT>').

Make a request #

Every service takes the client in its constructor, and every method takes named parameters and returns a typed model from package:dart_appwrite/models.dart.

import 'package:dart_appwrite/dart_appwrite.dart';
import 'package:dart_appwrite/models.dart' as models;

Users users = Users(client);

models.User user = await users.create(
  userId: ID.unique(),
  email: 'email@example.com',
  password: 'password',
  name: "Walter O'Brien",
);

Error handling #

The SDK throws an AppwriteException with message, code, type and response properties. Catch it to present the message to the user or to handle the error based on its type.

try {
  models.User user = await users.get(userId: '<USER_ID>');
} on AppwriteException catch (e) {
  print('${e.code} ${e.type}: ${e.message}');
}

Learn more #

Contribution #

This library is auto-generated by Appwrite custom SDK Generator. To learn more about how you can help us improve this SDK, please check the contribution guide before sending a pull-request.

License #

Please see the BSD-3-Clause license file for more information.

104
likes
140
points
29.2k
downloads

Documentation

Documentation
API reference

Publisher

verified publisherappwrite.io

Weekly Downloads

Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API

Homepage
Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

http

More

Packages that depend on dart_appwrite