gpt4 book ai didi

flutter - 无法将参数类型 'Object' 分配给参数类型“Map?

转载 作者:行者123 更新时间:2023-12-04 16:24:43 30 4
gpt4 key购买 nike

我遇到了这个错误:

The argument type 'Object' can't be assigned to the parameter type 'Map<String, dynamic>?
在这行代码中:
 listMakans = query.docs.map((m) => Makan.fromSnapshot(m.data()!)).toList();
这是 (Makan.fromSnapshot) 的代码:
Makan.fromSnapshot(Map<String, dynamic>? snapshot)
: id = snapshot!['id'],
owner = snapshot['owner'],
category = snapshot['category'],
hobby = snapshot['hobby'],
business = snapshot['business'],
title = snapshot['title'],
details = snapshot['details'],
latlng = snapshot['latlng'],
from = snapshot['from'].toDate(),
to = snapshot['to'].toDate(),
created = snapshot['created'].toDate(),
updated = snapshot['updated'].toDate();
我不明白这里的对象在哪里?

最佳答案

listMakans = query.docs.map((m) => Makan.fromSnapshot(m.data() as Map<String, dynamic>?)).toList();

关于flutter - 无法将参数类型 'Object' 分配给参数类型“Map<String, dynamic>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67406168/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com