参数类型 'Object?' 无法分配给参数类型 List

The argument type 'Object?' can't be assigned to the parameter type List

我一直在尝试将我的应用程序转换为新的 flutter 新版本,但出现此错误 The argument type Object? can't be assigned to the parameter type List that can't be修复....有人可以帮我解决这个问题

list() {
    return Expanded(
      child: FutureBuilder(
        future: employees,
        builder: (context, snapshot) {
          if (snapshot.hasData) {
            return dataTable(List<Url>.from(snapshot.data));
          }

          if (null == snapshot.data || snapshot.data == 0) {
            return Text("Tiada Data");
          }

          return CircularProgressIndicator();
        },
      ),
    );
  }

这是因为你需要转换你的 FutureBuilder 的类型。根据您的代码,我推断 employeesFuture<List> 类型或至少是 Future<Iterable> 类型,那么您应该像这样定义构建器的类型:

FutureBuilder<Iterable>(
  future: employees,
  builder: (context, snapshot) {
    if (snapshot.hasData) {
      return dataTable(List<Url>.from(snapshot.data!));
    }

    // ...
  },
),