I want to define a custom function that accepts a couple of parameters of generic type T (with an attribute productId).
I defined the function as below, but I can't compile or save it.bool isItemExistsInList<T extends {productId: String}>(List<T>? list, T? item) { if (list == null || item == null) { return false; } return list.any((element) => element.productId == item.productId); }