Back

Expected a value of type 'List<dynamic>', but got one of type 'Null' when creating a new user

  • 0
  • Flutter
  • Accounts
Elødran
14 Nov, 2023, 21:54

I have a form that collects user's email, username and password, and then calls the following function to create a user:

TypeScript
Future<void> signup({required String email, required String username, required String password}) async {
    try {
      // Create a new user
      awm.User u = await _account.create(userId: 'unique()', name: username ,email: email, password: password);

      // ...
    }
    catch (err) {
      if (err is aw.AppwriteException) {
        return Future.error(Exception(err.message));
      }
      else {
        return Future.error(Exception(err.toString()));
      }
    }
  }

The problem is that the first instruction in the try-catch block apparently throws an Exception saying Expected a value of type 'List<dynamic>', but got one of type 'Null', even if then checking on the Appwrite console the user is correctly created. Why is that happening, what am I doing wrong?

TL;DR
User is receiving an exception "Expected a value of type 'List<dynamic>', but got one of type 'Null'" when trying to create a new user in Flutter using Appwrite. They are using Flutter SDK version 8.1.0 and a self-hosted instance of Appwrite. The user has provided code and is looking for assistance in resolving the issue. Solution: - Check the version of the Appwrite instance and make sure it is the latest version. - Consider updating the Appwrite SDK to the latest version. - Provide a stack trace or more details about where the exception is being thrown. - Verify that the Appwrite SDK
Drake
14 Nov, 2023, 22:52
  1. Are you on Appwrite cloud?
  2. What version of the Appwrite Flutter SDK are you using?
Elødran
15 Nov, 2023, 07:21

I am using a self-hosted instance of Appwrite (with the latest version running on Oracle Cloud free tier) and version 8.1.0 of Flutter SDK

Elødran
15 Nov, 2023, 07:22

If it can help you troubleshooting I can try to change the endpoint to a project on Appwrite Cloud and run the same code to see if it behaves the same

Drake
15 Nov, 2023, 14:44

Please share the exact version of your Appwrite instance

Drake
15 Nov, 2023, 14:48

8.1.0 of the flutter SDK? You sure? I don't see any list attributes in that version: https://github.com/appwrite/sdk-for-flutter/blob/8.1.0/lib/src/models/account.dart.

Do you have a stack trace or something to give more detail about where exactly the exception was thrown? Maybe you can get the raw data returned from the server too?

Elødran
16 Nov, 2023, 12:01

Hey, the flutter SDK is the 8.1.0 yes, but double-checking the version of the server I realized it was not the last one available, my bad! I'll try to update it to 1.4.11 to see if something changes and update you back, thank you.

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