change element(0) at flutter code example
Example: flutter count list
var comments = <Comment>[...];
var count = comments.where((c) => c.product_id == someProductId).toList().length;
var comments = <Comment>[...];
var count = comments.where((c) => c.product_id == someProductId).toList().length;