mapAndRemoveEmpty<TCast> method

List<TCast> mapAndRemoveEmpty<TCast>(
  1. TCast? callback(
    1. T item
    )
)

Each element of the list is converted to TCast data using callback.

If the return value of callback is Null, the element is removed from the element.

It is returned as a List type, not as a Iterable type like map.

リストの各要素をcallbackを用いTCastのデータに変換します。

callbackの戻り値がNullの場合、要素から削除されます。

mapのようにIterable型ではなくList型で返されます。

Implementation

List<TCast> mapAndRemoveEmpty<TCast>(TCast? Function(T item) callback) {
  return map<TCast?>(callback).removeEmpty();
}