Skip to content
Back

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

  • 0
  • 3
  • 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
There is a bug in the Flutter SDK due to a required variable `$sequence`, but a PR to fix it is in progress. To resolve the issue, downgrade to version 17.0.1 until a new update is released (1.8.0) in the future.
11 Aug, 2025, 14:06

$sequence is not on self hosted 1.7.4, it's only on cloud. (same reason why we don't have upsert, as i saw you talked about it in the general)

11 Aug, 2025, 14:09

Thanks a lot for your answer, yeah I asked it on general too ๐Ÿ™‚

So there is currently a bug inside the Flutter SDK because the $sequence was a required variable, a PR is on the way : https://github.com/appwrite/sdk-generator/pull/1147 I doubted if this was a migration issue or SDK issue, now I know :p

1
11 Aug, 2025, 14:11

<@493852865907916800> Last question: even if there is no $sequence field, the atomic numeric option is working too on self-instance right? Like the cloud version?

11 Aug, 2025, 14:12

don't think as self hosted 1.7.4 is from may 22 and the atomic was created in june

1
14 Oct, 2025, 08:46

I am facing the same issue. Is there a recommended way going forward? Like using 18.0.0 instead of 17.1.0? Or downgrading to 17.0.1?

14 Oct, 2025, 11:13

you should downgrade it to a version without the $sequence to match the self hosted document structure. (i'm not a flutter dev, so i don't exacly know which version correspond to the 1.7.4 server version)

when they release the selfhosted 1.8.0 you will be able to upgrade the server then the SDK in your projects

1
14 Oct, 2025, 12:31

Thanks. I downgraded to 17.0.1 for the time being.

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