Skip to content

Commit 4cbf5d2

Browse files
committed
chore: update role helper class
1 parent 5a27780 commit 4cbf5d2

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
88
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
99

10-
**This SDK is compatible with Appwrite server version 1.0.0. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).**
10+
**This SDK is compatible with Appwrite server version 1.0.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).**
1111

1212
Appwrite is an open-source backend as a service server that abstract and simplify 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 Flutter 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](https://appwrite.io/docs)
1313

@@ -91,7 +91,7 @@ For web in order to capture the OAuth2 callback URL and send it to the applicati
9191
close the window.
9292
<script>
9393
window.opener.postMessage({
94-
flutter-web-auth2: window.___location.href
94+
flutter-web-auth-2: window.___location.href
9595
}, window.___location.origin);
9696
window.close();
9797
</script>

example/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,23 @@
33
Init your Appwrite client:
44

55
```dart
6-
Client client = Client();
7-
8-
client
9-
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
10-
.setProject('5e8cf4f46b5e8') // Your project ID
11-
.setSelfSigned() // Remove in production
12-
;
6+
Client client = Client();
137
8+
client
9+
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
10+
.setProject('5e8cf4f46b5e8') // Your project ID
11+
.setSelfSigned() // Remove in production
12+
;
1413
```
1514

1615
Create a new user and session:
1716

1817
```dart
1918
Account account = Account(client);
2019
21-
Response user = await account.create(userId: '[USER_ID]', email: '[email protected]', password: 'password', name: 'My Name');
20+
final user = await account.create(userId: '[USER_ID]', email: '[email protected]', password: 'password', name: 'My Name');
2221
23-
Response session = await account.createSession(email: '[email protected]', password: 'password');
22+
final session = await account.createEmailSession(email: '[email protected]', password: 'password');
2423
2524
```
2625

@@ -29,7 +28,7 @@ Fetch user profile:
2928
```dart
3029
Account account = Account(client);
3130
32-
Response profile = await account.get();
31+
final profile = await account.get();
3332
```
3433

3534
Upload File:
@@ -40,7 +39,7 @@ Storage storage = Storage(client);
4039
late InputFile file;
4140
4241
if(kIsWeb) {
43-
file = InputFile(file: await MultipartFile.fromFile('file', './path-to-file/image.jpg', filename: 'image.jpg'));
42+
file = InputFile(bytes: pickedFile.bytes, filename: 'image.jpg');
4443
} else {
4544
file = InputFile(path: './path-to-file/image.jpg', filename: 'image.jpg');
4645
}
@@ -49,8 +48,9 @@ storage.createFile(
4948
bucketId: '[BUCKET_ID]',
5049
fileId: '[FILE_ID]', // use 'unique()' to automatically generate a unique ID
5150
file: file,
52-
read: ['role:all'],
53-
write: []
51+
permissions: [
52+
Permission.read(Role.any()),
53+
],
5454
)
5555
.then((response) {
5656
print(response); // File uploaded!

lib/role.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,4 @@ class Role {
3333
static String member(String id) {
3434
return 'member:$id';
3535
}
36-
37-
static String status(String status) {
38-
return 'status:$status';
39-
}
4036
}

0 commit comments

Comments
 (0)