Dart/Flutter Deserialization of class type with base list class

The following doesn’t serialize correctly in dart:

public class TestResponse : List<TestData>
public class TestData {
    // stuff
public class TestRequest: IReturn<TestResponse> {}

Dart will throw the following error:

Unhandled Exception: type ‘_InternalLinkedHashMap<String, dynamic>’ is not a subtype of type ‘SearchByTickerResponseData’ of ‘element’

If I replace the wrapper class with the list it works fine.

Only Request DTOs can inherit from Lists otherwise Types can’t be both an object type and a collection which is unrepresentable in most serialization formats and not supported in ServiceStack.

1 Like

Thanks, I’ll keep it in mind, was just trying to have some better naming.