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

Hakim Rahim

i been trying to convert my app to new flutter new version but i got this error The argument type 'Object?' can't be assigned to the parameter type 'List' that can't be fix.... can somebody help me fix this problem

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();
        },
      ),
    );
  }
Guillaume Roux

It is because you need to cast the type of your FutureBuilder. Based on your code I deduce that employees is of type Future<List> or at least Future<Iterable> then you should define the type of your builder like this:

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

    // ...
  },
),

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

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

The argument type 'Object' can't be assigned to the parameter type 'ImageProvider<Object>?'

The argument type 'Object' can't be assigned to the parameter type 'ImageProvider<Object>?

Getting this error: "The argument type 'Object?' can't be assigned to the parameter type 'List<Map<String, Object>>'."

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

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

The argument type 'Object?' can't be assigned to the parameter type 'int'/ 'string'

The argument type 'Object?' can't be assigned to the parameter type 'num' in flutter

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

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

error: The argument type 'Object?' can't be assigned to the parameter type 'String'

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

The argument type 'Image' can't be assigned to the parameter type 'ImageProvider<Object>'

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

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

The argument type 'Object?' can't be assigned to the parameter type 'String'. 1

The argument type 'Null' can't be assigned to the parameter type 'QuerySnapshot<Object?>'

The argument type 'BoxShadow' can't be assigned to the parameter type 'List<BoxShadow>'

Argument type List<LatLng> can't be assigned to parameter type 'LatLng'

The argument type 'List<MaterialAccentColor>' can't be assigned to the parameter type 'MaterialColor'

The argument type can't be assigned to the parameter type 'List<int>'

The argument type 'List<dynamic>' can't be assigned to the parameter type 'Product'

The argument type 'List<dynamic>' can't be assigned to the parameter type 'Iterable<Object>'

Flutter Convert FromMap to list The argument type 'Object?' can't be assigned to the parameter type 'Map<String, dynamic>'

error: The argument type 'String' can't be assigned to the parameter type 'List<Object>'. flutter

Flutter - File() constructor "The argument type 'String' can't be assigned to the parameter type 'List<Object>'"

The argument type 'Object?' can't be assigned to the parameter type 'FutureOr<Uint8List>?'

Argument type 'List<Todolist>? Function(QuerySnapshot<Object?>)' can't assigned to parameter type 'List<Todolist> Function(QuerySnapshot<Object?>)

The argument type 'List<Todo>? Function(QuerySnapshot<Object?>)' can't be assigned to the parameter type 'List<Todo> Function(QuerySnapshot<Object?>)'