Skip to content

Commit 1f2dc8e

Browse files
authored
Merge pull request #303 from appwrite/dev
feat: Flutter SDK update for version 22.0.0
2 parents 78f9d7f + 720f87b commit 1f2dc8e

13 files changed

Lines changed: 55 additions & 53 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
# Change Log
22

3-
## 21.4.0
3+
## 22.0.0
44

5-
* Added upsert() to DocumentChannel and RowChannel to support upsert operations on documents and rows.
6-
* Added Query.contains, Query.containsAny, and Query.containsAll for enhanced filtering capabilities.
7-
8-
## 21.3.0
9-
10-
* Added memberships realtime channel helper
5+
* Breaking: Channel API no longer defaults to '*'; explicit IDs required.
6+
* Updated: Docs and README reflect 21.4.1; TTL examples added.
117

128
## 21.1.0
139

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.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).**
10+
**This SDK is compatible with Appwrite server version latest. 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 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 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

@@ -19,7 +19,7 @@ Add this to your package's `pubspec.yaml` file:
1919

2020
```yml
2121
dependencies:
22-
appwrite: ^21.4.0
22+
appwrite: ^22.0.0
2323
```
2424
2525
You can install packages from the command line:

docs/examples/databases/list-documents.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ DocumentList result = await databases.listDocuments(
1313
queries: [], // optional
1414
transactionId: '<TRANSACTION_ID>', // optional
1515
total: false, // optional
16+
ttl: 0, // optional
1617
);
1718
```

docs/examples/tablesdb/list-rows.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ RowList result = await tablesDB.listRows(
1313
queries: [], // optional
1414
transactionId: '<TRANSACTION_ID>', // optional
1515
total: false, // optional
16+
ttl: 0, // optional
1617
);
1718
```

lib/channel.dart

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ class _Membership {}
3030
class _Resolved {}
3131

3232
// Helper function for normalizing ID
33-
String _normalize(String id) => id.trim().isEmpty ? '*' : id.trim();
33+
String _normalize(String id) {
34+
final trimmed = id.trim();
35+
if (trimmed.isEmpty) {
36+
throw ArgumentError('Channel ID is required');
37+
}
38+
return trimmed;
39+
}
3440

3541
/// Channel class with generic type parameter for type-safe method chaining
3642
class Channel<T> {
@@ -58,25 +64,25 @@ class Channel<T> {
5864
String toString() => _segments.join('.');
5965

6066
// --- ROOT FACTORIES ---
61-
static Channel<_Database> database([String id = '*']) =>
67+
static Channel<_Database> database(String id) =>
6268
Channel<_Database>._(['databases', _normalize(id)]);
6369

64-
static Channel<_TablesDB> tablesdb([String id = '*']) =>
70+
static Channel<_TablesDB> tablesdb(String id) =>
6571
Channel<_TablesDB>._(['tablesdb', _normalize(id)]);
6672

67-
static Channel<_Bucket> bucket([String id = '*']) =>
73+
static Channel<_Bucket> bucket(String id) =>
6874
Channel<_Bucket>._(['buckets', _normalize(id)]);
6975

70-
static Channel<_Execution> execution([String id = '*']) =>
76+
static Channel<_Execution> execution(String id) =>
7177
Channel<_Execution>._(['executions', _normalize(id)]);
7278

73-
static Channel<_Func> function([String id = '*']) =>
79+
static Channel<_Func> function(String id) =>
7480
Channel<_Func>._(['functions', _normalize(id)]);
7581

76-
static Channel<_Team> team([String id = '*']) =>
82+
static Channel<_Team> team(String id) =>
7783
Channel<_Team>._(['teams', _normalize(id)]);
7884

79-
static Channel<_Membership> membership([String id = '*']) =>
85+
static Channel<_Membership> membership(String id) =>
8086
Channel<_Membership>._(['memberships', _normalize(id)]);
8187

8288
static String account() => 'account';
@@ -95,8 +101,8 @@ class Channel<T> {
95101

96102
/// Only available on Channel<_Database>
97103
extension DatabaseChannel on Channel<_Database> {
98-
Channel<_Collection> collection([String? id]) =>
99-
_next<_Collection>('collections', id ?? '*');
104+
Channel<_Collection> collection(String id) =>
105+
_next<_Collection>('collections', id);
100106
}
101107

102108
/// Only available on Channel<_Collection>
@@ -109,7 +115,7 @@ extension CollectionChannel on Channel<_Collection> {
109115

110116
/// Only available on Channel<_TablesDB>
111117
extension TablesDBChannel on Channel<_TablesDB> {
112-
Channel<_Table> table([String? id]) => _next<_Table>('tables', id ?? '*');
118+
Channel<_Table> table(String id) => _next<_Table>('tables', id);
113119
}
114120

115121
/// Only available on Channel<_Table>

lib/services/databases.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ class Databases extends Service {
124124
required String collectionId,
125125
List<String>? queries,
126126
String? transactionId,
127-
bool? total}) async {
127+
bool? total,
128+
int? ttl}) async {
128129
final String apiPath =
129130
'/databases/{databaseId}/collections/{collectionId}/documents'
130131
.replaceAll('{databaseId}', databaseId)
@@ -134,6 +135,7 @@ class Databases extends Service {
134135
if (queries != null) 'queries': queries,
135136
if (transactionId != null) 'transactionId': transactionId,
136137
if (total != null) 'total': total,
138+
if (ttl != null) 'ttl': ttl,
137139
};
138140

139141
final Map<String, String> apiHeaders = {};

lib/services/tables_db.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ class TablesDB extends Service {
120120
required String tableId,
121121
List<String>? queries,
122122
String? transactionId,
123-
bool? total}) async {
123+
bool? total,
124+
int? ttl}) async {
124125
final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'
125126
.replaceAll('{databaseId}', databaseId)
126127
.replaceAll('{tableId}', tableId);
@@ -129,6 +130,7 @@ class TablesDB extends Service {
129130
if (queries != null) 'queries': queries,
130131
if (transactionId != null) 'transactionId': transactionId,
131132
if (total != null) 'total': total,
133+
if (ttl != null) 'ttl': ttl,
132134
};
133135

134136
final Map<String, String> apiHeaders = {};

lib/src/client_browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
4040
'x-sdk-name': 'Flutter',
4141
'x-sdk-platform': 'client',
4242
'x-sdk-language': 'flutter',
43-
'x-sdk-version': '21.4.0',
43+
'x-sdk-version': '22.0.0',
4444
'X-Appwrite-Response-Format': '1.8.0',
4545
};
4646

lib/src/client_io.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ClientIO extends ClientBase with ClientMixin {
5858
'x-sdk-name': 'Flutter',
5959
'x-sdk-platform': 'client',
6060
'x-sdk-language': 'flutter',
61-
'x-sdk-version': '21.4.0',
61+
'x-sdk-version': '22.0.0',
6262
'X-Appwrite-Response-Format': '1.8.0',
6363
};
6464

lib/src/models/document.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Document implements Model {
55
/// Document ID.
66
final String $id;
77

8-
/// Document automatically incrementing ID.
8+
/// Document sequence ID.
99
final int $sequence;
1010

1111
/// Collection ID.

0 commit comments

Comments
 (0)