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

RPC doesn't work with Generic List<T> field into Message Class #134

Closed
supermuka opened this issue Nov 2, 2018 · 1 comment
Closed

RPC doesn't work with Generic List<T> field into Message Class #134

supermuka opened this issue Nov 2, 2018 · 1 comment

Comments

@supermuka
Copy link

supermuka commented Nov 2, 2018

SDK 2.0.0
RPC 0.6.0

Considering the following classes:

/// User classes
class UserBase {
   String id;
}

class User implements UserBase {
   String id;
   String name;
}

/// Group classes
class GroupBase {
  String id;
}

// this class is used as a Request Message on RPC
class GroupMessage<TUser extends UserBase> implements GroupBase {
  String id;
  String name;
  String surName;
  List<TUser> members;
  GroupMessage() {
    members = List<TUser>();
  }
}

class Group implements GroupMessage<User> {
  String id;
  String name;
  String surName;
  List<User> members;

  Group() {
    members = List<User>();
  }

  String get completeName => this.name + ' ' + this.surName; 
}

The following error is thrown when an instance of GroupMessage class defined with Generics is passed as a Request Param from Client to Server-Side on RPC and the RPC try to materialize an new instance on Server-Side from Json:

Field members has wrong type: type 'List<dynamic>' is not a subtype of type 'List<UserBase>' of 'value'

NOTE 1: This error occurs with SDK 2.0.0 + Generics. In SDK 2.1.0-dev.8.0 this error occurs using normal class without Generics too, like reported on issue #133

NOTE 2:: This error occurs when it's used Generic into List<T> field as in the example above: List<TUser> members;

@supermuka supermuka changed the title RPC doesn't work with Generics into Message Class RPC doesn't work with Generic List<T> field into Message Class Nov 19, 2018
@supermuka
Copy link
Author

it works fine now with PR #138.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant