You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// 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;
The text was updated successfully, but these errors were encountered:
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
SDK 2.0.0
RPC 0.6.0
Considering the following classes:
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: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;
The text was updated successfully, but these errors were encountered: