Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: type List<dynamic>' is not a subtype of type 'List<String> #224

Open
2 tasks done
develocode777 opened this issue Dec 20, 2024 · 4 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@develocode777
Copy link

develocode777 commented Dec 20, 2024

👟 Reproduction steps

When I try this portion of code:

DocumentList listGeneralInfo = await globals.appwriteDB.listDocuments( collectionId: Env.appwriteGeneralInfoCollection, databaseId: Env.appwriteGeneralInfo, );

I get the error List<dynamic>' is not a subtype of type 'List<String>

👍 Expected behavior

There should be no errors.

👎 Actual Behavior

I get the error List<dynamic>' is not a subtype of type 'List<String>

🎲 Appwrite version

Different version (specify in environment)

💻 Operating system

Linux

🧱 Your Environment

self-hosted 1.6.0

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@develocode777 develocode777 added the bug Something isn't working label Dec 20, 2024
@develocode777
Copy link
Author

I downloaded the package locally and modified this portion of the code (session.dart) as someone suggested in discord and now it works:

factors: map['factors'] ?? [], to factors: map['factors'].cast<String>() ?? <String>[],

  factory Session.fromMap(Map<String, dynamic> map) {
    return Session(
      $id: map['\$id'].toString(),
      $createdAt: map['\$createdAt'].toString(),
      $updatedAt: map['\$updatedAt'].toString(),
      userId: map['userId'].toString(),
      expire: map['expire'].toString(),
      provider: map['provider'].toString(),
      providerUid: map['providerUid'].toString(),
      providerAccessToken: map['providerAccessToken'].toString(),
      providerAccessTokenExpiry: map['providerAccessTokenExpiry'].toString(),
      providerRefreshToken: map['providerRefreshToken'].toString(),
      ip: map['ip'].toString(),
      osCode: map['osCode'].toString(),
      osName: map['osName'].toString(),
      osVersion: map['osVersion'].toString(),
      clientType: map['clientType'].toString(),
      clientCode: map['clientCode'].toString(),
      clientName: map['clientName'].toString(),
      clientVersion: map['clientVersion'].toString(),
      clientEngine: map['clientEngine'].toString(),
      clientEngineVersion: map['clientEngineVersion'].toString(),
      deviceName: map['deviceName'].toString(),
      deviceBrand: map['deviceBrand'].toString(),
      deviceModel: map['deviceModel'].toString(),
      countryCode: map['countryCode'].toString(),
      countryName: map['countryName'].toString(),
      current: map['current'],
      factors: map['factors'].cast<String>() ?? <String>[],
      secret: map['secret'].toString(),
      mfaUpdatedAt: map['mfaUpdatedAt'].toString(),
    );

@nathanael540
Copy link

createExecution show the same error

type 'List<dynamic>' is not a subtype of type 'List<String>'
StackTrace: #0      new Execution.fromMap (package:appwrite/src/models/execution.dart:81:42)
#1      Functions.createExecution (package:appwrite/services/functions.dart:68:29)
<asynchronous suspension>

@Gajjar-Mohit
Copy link

Gajjar-Mohit commented Dec 30, 2024

Facing same error in user.dart and session.dart

While using account!.createEmailPasswordSession();
Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'List<String>' new Session.fromMap (package:appwrite/src/models/session.dart:152:31) Account.createEmailPasswordSession (package:appwrite/services/account.dart:646:27)

While using account.create(userId: ID.unique(), name: name, email: email, password: password);
Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'List<String>' E/flutter (29288): #0 new User.fromMap (package:appwrite/src/models/user.dart:95:29) E/flutter (29288): #1 Account.create (package:appwrite/services/account.dart:56:24)

@sabitzhambay
Copy link

sabitzhambay commented Dec 30, 2024

You just need to replace 'final List< String > factors' with 'final List factors' inside the Session class or update to version 14.0.0-rc1. This error is fixed there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants