Skip to content

🐛 Bug Report: Breaking Change in Appwrite SDK: type 'Null' is not a subtype of type 'int' in lisiting documents #10253

@ralmutaweh

Description

@ralmutaweh

👟 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?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingproduct / databasesFixes and upgrades for the Appwrite Database.

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions