-
Notifications
You must be signed in to change notification settings - Fork 317
Expand file tree
/
Copy path+page.markdoc
More file actions
57 lines (43 loc) · 1.7 KB
/
+page.markdoc
File metadata and controls
57 lines (43 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
layout: tutorial
title: Set up Appwrite
description: Import and initialize Appwrite for your Flutter application.
step: 3
---
## Create project {% #create-project %}
Head to the [Appwrite Console](https://cloud.appwrite.io/console).
{% only_dark %}

{% /only_dark %}
{% only_light %}

{% /only_light %}
If this is your first time using Appwrite, create an account and create your first project.
Then, under **Add a platform**, add a Flutter platform (Android/iOS/Linux etc.) with the package/bundle ID `com.example.ideas_tracker`.
{% only_dark %}

{% /only_dark %}
{% only_light %}

{% /only_light %}
You can skip optional steps.
## Initialize Appwrite SDK {% #init-sdk %}
To use Appwrite in our Flutter app, you'll need to find our project ID.
Find your project's ID in the **Settings** page.
{% only_dark %}

{% /only_dark %}
{% only_light %}

{% /only_light %}
Create a new file `lib/appwrite.dart` to hold our Appwrite related code.
Only one instance of the `Client()` should be created per app.
Add the following code to it, replacing `<PROJECT_ID>` with your project ID.
```dart
import 'package:appwrite/appwrite.dart';
final client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1")
.setProject("<PROJECT_ID>");
final account = Account(client);
final db = Databases(client);
```