expandAndRemoveEmpty<TCast> method

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

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

The return value of callback can be Iterable or List, all of which will be each element of the list.

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

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

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

callbackの戻り値はIterableListを指定でき、その全要素がリストの各要素となります。

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

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

Implementation

List<TCast> expandAndRemoveEmpty<TCast>(
  Iterable<TCast?> Function(T item) callback,
) {
  return expand<TCast?>(callback).removeEmpty();
}