Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase 类型'_内部链接dhashmap<;动态,动态>';不是类型为';地图<;字符串,动态>';_Firebase_Dart_Flutter - Fatal编程技术网

Firebase 类型'_内部链接dhashmap<;动态,动态>';不是类型为';地图<;字符串,动态>';

Firebase 类型'_内部链接dhashmap<;动态,动态>';不是类型为';地图<;字符串,动态>';,firebase,dart,flutter,Firebase,Dart,Flutter,在最近的firebase更新之后,控制台会抛出此错误。 下面是导致问题的代码。 我正在使用firebase_数据库:^1.0.0 User.dict(String key, Map<String, dynamic> dict) { final username = dict["username"] as String; final imageUrl = dict["image_url"] as String; this.id = key; this.username = usern

在最近的firebase更新之后,控制台会抛出此错误。 下面是导致问题的代码。 我正在使用firebase_数据库:^1.0.0

User.dict(String key, Map<String, dynamic> dict) {
final username = dict["username"] as String;
final imageUrl = dict["image_url"] as String;

this.id = key;
this.username = username;
this.imageUrl = imageUrl;
User.dict(字符串键,映射dict){
最终用户名=dict[“username”]作为字符串;
final imageUrl=dict[“image_url”]作为字符串;
this.id=键;
this.username=用户名;
this.imageUrl=imageUrl;

}

使用字符串,而不是动态。

请添加足够的上下文,以便其他人帮助您。考虑包括使用的包或库,哪些版本,以及代码如何失败的示例。仅此代码段不足以帮助您。是哪一行导致了异常?我猜您在需要Map.User.dict(字符串键,Map-dict)时给了它一个HashMap(主要是json){导致错误。此构造函数声明没有导致错误。声明没有问题。某些代码正在使用类型为
map
的映射调用构造函数。您需要找到该代码并修复它,或者将
dict
的参数类型更改为
map