Back

type 'Null' is not a subtype of type 'bool'

  • 0
  • Databases
  • Auth
  • Flutter
沈成林
28 Mar, 2024, 09:42

My English is not very good, please forgive me

When I use this function "account.get()" and "account.create()", they both remind me like this: type "Null" is not a subtype of type "bool". But strangely enough, I did manage to create a new account.

Here is my sign code: // 注册方法 signUp(String userId, String email, String password, String name, Function onSuccess) { _account .create(userId: userId, email: email, password: password, name: name) .then((value) => onSuccess(value), onError: (error) { print("注册失败:${error}"); }); }

Here is my get code: Future<User> getUser(){ return _account.get(); }

// i use it in getx's init function Future<void> onInit() async { super.onInit(); appWriteManager.getUser().then((value) { print("user:${value}"); },onError: (error){ print("get user 出错:${error}"); }); }

this is error message: I/flutter ( 8300): get user 出错:type 'Null' is not a subtype of type 'bool' E/libEGL ( 8300): called unimplemented OpenGL ES API E/libEGL ( 8300): called unimplemented OpenGL ES API I/art ( 8300): Do partial code cache collection, code=17KB, data=31KB I/art ( 8300): After code cache collection, code=17KB, data=31KB I/art ( 8300): Increasing code cache capacity to 128KB E/libEGL ( 8300): called unimplemented OpenGL ES API I/flutter ( 8300): 注册失败:type 'Null' is not a subtype of type 'bool' I/flutter ( 8300): 注册失败:AppwriteException: user_already_exists, A user with the same id, email, or phone already exists in this project. (409)

TL;DR
Developers are encountering the error "type 'Null' is not a subtype of type 'bool'". They're advised to check Appwrite and SDK versions for compatibility. In code, calling account.get() and account.create() prompt the same error, yet account creation succeeds. The issue may lie in the SDK or logic.提示升级或降级SDK版本以确保兼容性。
沈成林
29 Mar, 2024, 02:00

Can anyone help me answer this question?

Jace
29 Mar, 2024, 12:26

Need to create session before calling get() function.

(创建成功后,还需要按登录的流程去创建session,才能使用 get() )

Jace
29 Mar, 2024, 12:29

My TypeScript code eg:

Steven
30 Mar, 2024, 16:39

Double check your SDK version is compatible with your Appwrite version

tanishq
30 Mar, 2024, 17:44

use node_sdk v11.1.0

沈成林
1 Apr, 2024, 09:11

Thank you so much,I just changed my appwrite version to ^11.0.1, but why?

沈成林
1 Apr, 2024, 09:12

Thank you so much,I also modified this part of the logic

Steven
1 Apr, 2024, 15:56

what version of Appwrite are you using (you can check at the bottom right of the Appwrite Console)?

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