Skip to content
Init is coming / May 19 - 23
Back

Functions on 1.6.0 return wrong datatype from the appwrite sdk

  • 0
  • Self Hosted
  • Flutter
  • Functions
  • Auth
Kuromory
5 Dec, 2024, 13:09

I use the dart-3.3 runtime for my functions and the dart_appwrite (v12.1.0) package for some user changes. So when I for example use _users.create('foo@foo.com') I get the exception that String is not a subtype of type Map<String,dynamic> where the sdk trys to use User.fromMap(req.data)... it worked in 1.5.11 so is there a migration error or do I need to change some settings?

TL;DR
Issue: Developers are facing datatype errors in appwrite SDK 1.6.0 when using functions like `users.create`. The error "type 'String' is not a subtype of type 'Map<String, dynamic>'" is observed on upgrading from SDK 1.5.11. Solution: This error might be due to changes in SDK. In version 1.6.0, the function `create` expects a Map<String, dynamic> type instead of a string. Developers need to update their code to pass the correct data type when calling `users.create`.
Kuromory
5 Dec, 2024, 13:10

code

TypeScript
   var user = await users.create(
        userId: userId,
        email: payload['email'],
        name: payload['name'],
      );
Kuromory
5 Dec, 2024, 13:11

error

TypeScript
type 'String' is not a subtype of type 'Map<String, dynamic>'
#0      Users.create (package:dart_appwrite/services/users.dart:55)
<asynchronous suspension>
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