Skip to content

List<dynamic> is not a sub-type of type List<String> #29

@Okiring

Description

@Okiring

static List<String?> _lubanCompressList(List objects) {
var results = [];
objects.forEach((_o) {
results.add(_lubanCompress(_o));
});
return results as List<String?>;
}

The above method was causing that error: Had to change to the below and resolved the error

static List<String?> _lubanCompressList(List objects) {
var results = [];
objects.forEach((_o) {
results.add(_lubanCompress(_o));
});
return (results as List<dynamic?>).cast<String?>();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions