Skip to content
Back

I am facing this error: type 'Null' is not a subtype of type 'int'

  • 0
  • Self Hosted
  • Flutter
  • Databases
ralm06
1 Aug, 2025, 20:10

When attempting to fetch areas from the area collection, the application throws an error: "type 'Null' is not a subtype of type 'int.'" This issue originates in the AreaModel.fromJson constructor, indicating that expected integer fields are receiving null values.

Environment:

Both the SDK and the self-hosted Appwrite server are running on the latest versions.

I encountered the same problem earlier in the day when fetching data from the server, which was resolved by downgrading the Appwrite SDK to version 16.1.0. However, again, this issue has emerged in the functionality related to fetching areas.

Any help would be appreciated!

TL;DR
Error: Type 'Null' is not a subtype of type 'int.' Issue arises from missing sequence in json when using Dart Appwrite package. Solution: Downgrade Flutter Appwrite to version 17.0.1 to handle null correctly.
ralm06
2 Aug, 2025, 09:38

?

freppsa
4 Aug, 2025, 12:24

Having the same issue after upgrading to "dart_appwrite: ^16.2.0" seems to be related to missing sequence in json.

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, ); }

Maryusz
4 Aug, 2025, 13:19

Use appwrite: 17.0.1 the $sequence can return null but the 17.0.2 and over doesn't handle it correctly.

freppsa
5 Aug, 2025, 10:37

@Maryusz Thanks for the reply

im using the dart only package dart_appwrite since its a dart only package.

Richard Spencer
10 Aug, 2025, 10:36

I have experienced the same problem. Seems to be fixed by downgrading Flutter Appwrite to 17.0.1

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