类型 'List<Widget>' 不是函数的子类型 'List<Map<String,Object>>' ... flutter
type 'List<Widget>' is not a subtype 'List<Map<String,Object>>' of function... flutter
我有变量
final List<Map<String, Object>> _pages = [
{'page': Page1(), 'title': 'Page1'},
{'page': Page2(), 'title': 'Page2'}
];
然后在 appBar 标题中我想使用这个变量
title: Text(_pages[1]['title']),
但是我得到错误
type 'List' is not a subtype of type
'List<Map<String,Object>>'....
我尝试使用动态而不是 Object,但没有帮助。
有什么办法吗?
这样做:
title: Text(((_pages[1])['title']).toString()),
我有变量
final List<Map<String, Object>> _pages = [
{'page': Page1(), 'title': 'Page1'},
{'page': Page2(), 'title': 'Page2'}
];
然后在 appBar 标题中我想使用这个变量
title: Text(_pages[1]['title']),
但是我得到错误
type 'List' is not a subtype of type 'List<Map<String,Object>>'....
我尝试使用动态而不是 Object,但没有帮助。 有什么办法吗?
这样做:
title: Text(((_pages[1])['title']).toString()),