Back

[SOLVED] Exception when retrieving current user

  • 0
  • Users
  • Flutter
Arrow
19 Sep, 2023, 19:48

Hello, What are the probable causes for this exception when I run the getCurrentUser:

TypeScript

Future<User> getCurrentUser() async =>
    Account(_client).get().then((value) => value);```
Exception```Unhandled Exception: type 'Null' is not a subtype of type 'List<dynamic>'```
TL;DR
The user is experiencing an exception when trying to retrieve the current user in Flutter. The solution is to downgrade the flutter plugin to version 9.0.0. The Appwrite flutter SDK version 11 is meant for Appwrite 1.4, so it needs to be downgraded. The exception message suggests that there is a type error, specifically 'Null' not being a subtype of 'List<dynamic>'.
Arrow
19 Sep, 2023, 19:49
TypeScript
#0      new User.fromMap (package:appwrite/src/models/user.dart:87:18)
#1      Account.get (package:appwrite/services/account.dart:23:24)
<asynchronous suspension>```
Drake
19 Sep, 2023, 19:54

What version of Appwrite are you on and what version of the Appwrite flutter sdk are you using?

Arrow
19 Sep, 2023, 19:55

Hello Steve,

appwrite: ^11.0.0 => flutter Appwrite console version 1.3.7

Drake
19 Sep, 2023, 19:56

Version 11 of the Appwrite flutter sdk is meant for Appwrite 1.4. Please downgrade, checking the readme to see what version you should use

Arrow
19 Sep, 2023, 19:56

I just downgraded the flutter plugin to 9.0.0 and it worked! That's the workaround I guess?

Arrow
19 Sep, 2023, 19:56

Perfect. Thank you!

Arrow
19 Sep, 2023, 19:57

[SOLVED] Exception when retrieving current user

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