flutter map 报错记录

305 阅读1分钟

使用 List map时出现了如下报错:

type 'List<Widget>' is not a subtype of type 'Widget'

解决方法:

Wrap(
    spacing: 4,
    children: <Widget>[...test()],
),

test(){
    return List list = testMap.map<Widget>(item=>Text(item)).toList();
}