Method invocation or access on a 'property' target. Try giving the target a type

I had this lint error in several of my http json decode responses. The response was a simple list:

http response [{"total":2}]

Using List.from() was the solution. You can read about it here:

My final code:

      final List<dynamic> result = jsonDecode(response.body) as List<dynamic>;
      final List<Map<String, dynamic>> item =
          List<Map<String, dynamic>>.from(result);
      final int totalComments = int.parse(item[0]['total'].toString());