Skip to content
Back

Unhandled Exception: type 'Null' is not a subtype of type 'int'

  • 0
  • Self Hosted
  • Flutter
iStornZ
11 Aug, 2025, 11:30

Hello I upgraded my instance from 1.6.2 to latest 1.7.4, doing migration. All seems to work fine but when I use the latest version of the appwrite plugin on my Flutter app (17.1.0) and trying to list documents I got "Unhandled Exception: type 'Null' is not a subtype of type 'int'".

I debugged and found that my instance do not return the field $sequence which is required in the appwrite library:

TypeScript
factory Document.fromMap(Map<String, dynamic> map) {
    return Document(
      $id: map['\$id'].toString(),
      $sequence: map['\$sequence'],
      $collectionId: map['\$collectionId'].toString(),
      $databaseId: map['\$databaseId'].toString(),
      $createdAt: map['\$createdAt'].toString(),
      $updatedAt: map['\$updatedAt'].toString(),
      $permissions: List.from(map['\$permissions'] ?? []),
      data: map,
    );
  }

How to fix that?

TL;DR
Upgraded instance to 1.7.4, Flutter app using appwrite plugin 17.1.0, error: "Unhandled Exception: type 'Null' is not a subtype of type 'int'." Issue due to missing field `$sequence`. Fix: Add a null check for `$sequence` in the `Document.fromMap` factory.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more