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 message: "type 'Null' is not a subtype of type 'int'" occurs when fetching areas because expected integer fields are receiving null values in the AreaModel.fromJson constructor. Environment: SDK and self-hosted Appwrite server are up to date. Previous solution of downgrading SDK to version 16.1.0 worked once but issue reemerged when fetching areas. Solution: Ensure proper handling for nullable values when converting JSON to model.
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