-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
bugSomething isn't workingSomething isn't workingproduct / databasesFixes and upgrades for the Appwrite Database.Fixes and upgrades for the Appwrite Database.
Description
👟 Reproduction steps
Use the latest version of the Appwrite SDK and self self-hosted server version.
Call the listDocuments method to fetch documents from a collection.
Attempt to process the documents into model objects using the fromJson method.
try {
final response = await databases.listDocuments(
databaseId: databaseId,
collectionId: collectionId,
);
return response.documents
.map((doc) => EstablishmentModel.fromJson(doc.data))
.toList();
} catch (e) {
print('Error fetching documents: ${e.toString()}');
return [];
}
👍 Expected behavior
The documents should be returned without causing type errors.
👎 Actual Behavior
This is returned:
flutter: Error fetching establishments: type 'Null' is not a subtype of type 'int'
#0 new Document.fromMap (package:appwrite/src/models/document.dart:42:21)
#1 new DocumentList.fromMap.<anonymous closure> (package:appwrite/src/models/document_list.dart:17:46)
#2 MappedListIterable.elementAt (dart:_internal/iterable.dart:442:31)
#3 ListIterator.moveNext (dart:_internal/iterable.dart:371:26)
#4 new List.from (dart:core-patch/array_patch.dart:30:17)
#5 new DocumentList.fromMap (package:appwrite/src/models/document_list.dart:16:18)
#6 Databases.listDocuments (package:appwrite/services/databases.dart:32:32)
<asynchronous suspension>
🎲 Appwrite version
Different version (specify in environment)
💻 Operating system
MacOS
🧱 Your Environment
Appwrite SDK version: ^17.1.0
Appwrite Server: 1.7.4
Flutter version: Latest
👀 Have you spent some time to check if this issue has been raised before?
- I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- I have read the Code of Conduct
Gizmo1337, istornz, LevenLeD and lucky69luktndevDE, istornz and LevenLeD
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingproduct / databasesFixes and upgrades for the Appwrite Database.Fixes and upgrades for the Appwrite Database.
Type
Projects
Status
In Progress