Skip to content

Commit 3772b2a

Browse files
committed
🐛 Fixed Bugs in the Adapter
1 parent 50f54b1 commit 3772b2a

File tree

9 files changed

+30
-24
lines changed

9 files changed

+30
-24
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,10 @@
4040
### Notes
4141
- This is the initial release and should be considered beta
4242
- Feedback and contributions are welcome
43-
- Testing in production environments is recommended before critical usage
43+
- Testing in production environments is recommended before critical usage
44+
45+
## [0.0.2] - 2024-11-23
46+
47+
### Improvements
48+
- Fixed Flutter Data Documentation Link
49+
- Fixed Bug in the Adapter's `sendRequest`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ A Flutter Data adapter for Appwrite that provides offline support, real-time upd
1616
Before using this package, make sure you:
1717

1818
1. Have a working Appwrite backend setup
19-
2. Understand and follow [Flutter Data's setup guide](https://flutterdata.dev/getting-started) carefully
19+
2. Understand and follow [Flutter Data's setup guide](https://flutterdata.dev) carefully
2020
3. Are using Riverpod for state management
2121

2222
This package only handles the Appwrite integration with Flutter Data. All other Flutter Data configurations must be properly set up.

lib/adapters/appwrite.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ mixin AppwriteAdapter<T extends DataModel<T>> on RemoteAdapter<T> {
175175
try {
176176
final collectionId = type;
177177
final documentId =
178-
uri.pathSegments.length > 1 ? uri.pathSegments[1] : null;
178+
uri.pathSegments.length > 2 ? uri.pathSegments[2] : null;
179179

180180
dynamic response;
181181

lib/config.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ final locator = GetIt.instance;
66
/// Configuration class for AppwriteAdapter
77
class AppwriteOffline {
88
/// Initializes the AppwriteAdapter configuration and sets up Appwrite services
9-
///
9+
///
1010
/// Parameters:
1111
/// - [projectId]: Your Appwrite project ID
1212
/// - [databaseId]: Your Appwrite database ID
1313
/// - [endpoint]: Appwrite API endpoint (defaults to 'https://cloud.appwrite.io/v1')
1414
/// - [selfSigned]: Whether to allow self-signed certificates (defaults to false)
1515
/// - [jwt]: Optional JWT token for authenticated requests
16-
///
16+
///
1717
/// Example:
1818
/// ```dart
1919
/// void main() {
@@ -50,7 +50,7 @@ class AppwriteOffline {
5050
locator.registerSingleton<Databases>(
5151
Databases(client),
5252
);
53-
53+
5454
locator.registerSingleton<Realtime>(
5555
Realtime(client),
5656
);
@@ -121,4 +121,4 @@ class AppwriteOffline {
121121
return false;
122122
}
123123
}
124-
}
124+
}

lib/global.dart

Whitespace-only changes.

lib/models/filter.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// A utility class that represents a filter condition for database queries.
2-
///
2+
///
33
/// This class is used to convert Flutter Data's filter syntax into Appwrite's query format.
44
/// It handles both simple equality filters and complex operator-based filters.
55
class Filter {
@@ -10,7 +10,7 @@ class Filter {
1010
final dynamic value;
1111

1212
/// The operator to use for comparison
13-
///
13+
///
1414
/// Supported operators:
1515
/// - '==' (equality)
1616
/// - '!=' (inequality)
@@ -32,16 +32,16 @@ class Filter {
3232
Filter(this.field, this.value, this.operator);
3333

3434
/// Creates a Filter instance from a JSON map.
35-
///
35+
///
3636
/// Handles two formats:
3737
/// 1. Simple equality: `{"fieldName": value}`
3838
/// 2. Operator-based: `{"fieldName": {"$operator": value}}`
39-
///
39+
///
4040
/// Example:
4141
/// ```dart
4242
/// // Simple equality
4343
/// Filter.fromJson({"name": "John"}); // Creates equality filter
44-
///
44+
///
4545
/// // Operator-based
4646
/// Filter.fromJson({
4747
/// "age": {">=": 18}
@@ -56,4 +56,4 @@ class Filter {
5656
return Filter(entry.key, entry.value, '==');
5757
}
5858
}
59-
}
59+
}

lib/models/object_id.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/// A utility function to safely access document metadata fields from Appwrite responses.
2-
///
2+
///
33
/// This function handles both normal field access and Appwrite's metadata fields
44
/// (prefixed with $). It's particularly useful for accessing fields like id,
55
/// createdAt, and updatedAt which can come in both normal and $ prefixed forms.
6-
///
6+
///
77
/// Parameters:
88
/// - [map]: The document map to access
99
/// - [string]: The field name to retrieve
10-
///
10+
///
1111
/// Returns the value of the field or null if not found
12-
///
12+
///
1313
/// Example:
1414
/// ```dart
1515
/// // Accessing a document's ID
1616
/// final id = $(document, 'id'); // Will return either document['id'] or document['$id']
17-
///
17+
///
1818
/// // Accessing creation timestamp
1919
/// final createdAt = $(document, 'createdAt'); // Returns document['createdAt'] or document['$createdAt']
2020
/// ```
2121
Object? $(map, string) {
2222
return map[string] ?? map['\$$string'];
23-
}
23+
}

lib/models/where.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:appwrite_offline/models/filter.dart';
22

33
/// A class that represents a collection of filters to be applied in a database query.
4-
///
4+
///
55
/// This class is used to group multiple [Filter] conditions together for complex queries.
66
class Where {
77
/// List of filters to be applied
@@ -11,9 +11,9 @@ class Where {
1111
Where(this.filters);
1212

1313
/// Creates a Where instance from a JSON map.
14-
///
14+
///
1515
/// The JSON map should contain field-value pairs or field-operator-value pairs.
16-
///
16+
///
1717
/// Example:
1818
/// ```dart
1919
/// Where.fromJson({
@@ -26,4 +26,4 @@ class Where {
2626
return Where(
2727
json.entries.map((e) => Filter.fromJson({e.key: e.value})).toList());
2828
}
29-
}
29+
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: appwrite_offline
22
description: "A Flutter Data adapter for Appwrite that provides offline support, real-time updates, and seamless integration with Flutter Data's powerful features."
3-
version: 0.0.1
3+
version: 0.0.2
44
homepage: https://github.com/cybroidtech/appwrite_offline
55
repository: https://github.com/cybroidtech/appwrite_offline
66
issue_tracker: https://github.com/cybroidtech/appwrite_offline/issues

0 commit comments

Comments
 (0)