flutter - Dart 无法识别类型
问题描述
这是简化的源代码,我正在从 firebase 数据库中获取 dataBaseList,我知道它只包含字符串:
List<String> stringList;
stringList = dataBaseList;
它返回此错误:'List<dynamic>' is not a subtype of type 'List<String>
所以我认为这个解决方案可能会解决这个问题:
List<String> stringList;
stringList = dataBaseList as List<String>;
但是,它现在返回此错误:
type 'List<dynamic>' is not a subtype of type 'List<String>' in type cast
有针对这个的解决方法吗?
我对 Stackoverflow 约定不太熟悉,所以如果我违反了任何约定,我很抱歉
解决方案
推荐阅读
- javascript - 从 gulp-watch 的 .on() 事件运行任务
- sql - 检查一列的值是否在另一个表的列中,如果是则返回另一列的值
- scala - 将 ZipWith Outlet 连接到另一个 ZipWith 作为 Inlet
- input - 用户输入的音频流
- c++ - Mojave 上 SDL_CreateRenderer() 的“无效上下文 0x0”?
- java - 使用 Java 找出独特的因素
- mysql - mysql查询中的多表内连接
- python - Python 无需我询问就使用多核
- influxdb - 如何在 InfluxDB 测量中存储版本化数据?
- javascript - 使整个 BS4 导航栏(在小屏幕上)区域可点击,因此在您触摸的任何地方,它都会显示/隐藏子菜单?