Skip to content

YamlList needs to take type parameters? #1901

Closed
@eseidel

Description

@eseidel

I'm attempting to make some of my code strong-mode clean.

For example:

    YamlList yamlItems = yamlMob['items'];
    if (yamlItems != null) {
      yamlItems.forEach(
          (String itemName) => mob.addItem(creator.items.itemByName(itemName)));
    }

Complains:

file: 'file:///Stuff/Projects/lol_duel/lib/utils/duel.dart'
severity: 'Info'
message: 'A function of type '(String) → Item' can't be assigned to a variable of type '(dynamic) → void'.'
at: '46,11'
source: 'dart'
code: 'uses_dynamic_as_bottom'

If this were a normal list, I'd fix it by using:
List<String> items

But I can't do that for YamlList, even thought it implements ListMixin which takes a type parameter:
abstract class ListMixin<E> implements List<E> {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions