Skip to content

Commit af97ef2

Browse files
committed
Update doc
1 parent da30c6d commit af97ef2

File tree

165 files changed

+11082
-12583
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+11082
-12583
lines changed

README.md

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,38 +39,29 @@ dart pub add dart_appwrite
3939
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:
4040

4141
```dart
42-
import 'package:dart_appwrite/dart_appwrite.dart';
43-
44-
void main() async {
45-
Client client = Client()
46-
.setEndpoint('http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible
47-
.setProject('5ff3379a01d25') // Your project ID
48-
.setKey('cd868c7af8bdc893b4...93b7535db89')
49-
.setSelfSigned(); // Use only on dev mode with a self-signed SSL cert
50-
51-
Users users = Users(client);
52-
53-
try {
54-
final user = await users.create(userId: ID.unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien");
55-
print(user.toMap());
56-
} on AppwriteException catch(e) {
57-
print(e.message);
58-
}
59-
}
42+
Client client = Client()
43+
.setProject('<YOUR_PROJECT_ID>')
44+
.setKey('<YOUR_API_KEY>');
45+
46+
Users users = Users(client);
47+
48+
User user = await users.create(
49+
userId: ID.unique(),
50+
email: 'email@example.com',
51+
phone: '+123456789',
52+
password: 'password',
53+
name: 'Walter O'Brien'
54+
);
6055
```
6156

6257
### Error handling
6358
The Appwrite Dart SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
6459

6560
```dart
66-
Users users = Users(client);
67-
6861
try {
69-
final user = await users.create(userId: ID.unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien");
70-
print(user.toMap());
62+
User user = await users.create(...);
7163
} on AppwriteException catch(e) {
72-
//show message to user or do other operation based on error as required
73-
print(e.message);
64+
// Handle the error
7465
}
7566
```
7667

lib/client_browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export 'src/client_browser.dart';
1+
export 'src/client_browser.dart';

lib/client_io.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export 'src/client_io.dart';
1+
export 'src/client_io.dart';

lib/query.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ class Query {
1111
Map<String, dynamic> toJson() {
1212
final map = <String, dynamic>{'method': method};
1313

14-
if (attribute != null) {
14+
if(attribute != null) {
1515
map['attribute'] = attribute;
1616
}
17-
18-
if (values != null) {
17+
18+
if(values != null) {
1919
map['values'] = values is List ? values : [values];
2020
}
2121

@@ -26,7 +26,7 @@ class Query {
2626
String toString() => jsonEncode(toJson());
2727

2828
/// Filter resources where [attribute] is equal to [value].
29-
///
29+
///
3030
/// [value] can be a single value or a list. If a list is used
3131
/// the query will return resources where [attribute] is equal
3232
/// to any of the values in the list.
@@ -144,14 +144,14 @@ class Query {
144144
Query._('orderDesc', attribute).toString();
145145

146146
/// Return results before [id].
147-
///
147+
///
148148
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
149149
/// docs for more information.
150150
static String cursorBefore(String id) =>
151151
Query._('cursorBefore', null, id).toString();
152152

153153
/// Return results after [id].
154-
///
154+
///
155155
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
156156
/// docs for more information.
157157
static String cursorAfter(String id) =>
@@ -161,9 +161,9 @@ class Query {
161161
static String limit(int limit) => Query._('limit', null, limit).toString();
162162

163163
/// Return results from [offset].
164-
///
164+
///
165165
/// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination)
166166
/// docs for more information.
167167
static String offset(int offset) =>
168168
Query._('offset', null, offset).toString();
169-
}
169+
}

lib/role.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ class Role {
6363
static String label(String name) {
6464
return 'label:$name';
6565
}
66-
}
66+
}

0 commit comments

Comments
 (0)