doTransformToList<T> function
List<T> ?
doTransformToList<T>(
- Object? o,
- DataTransformerTo<
T> ? transformerTo, - DataTransformerToList<
T> ? transformerToList
Implementation
List<T>? doTransformToList<T>(Object? o, DataTransformerTo<T>? transformerTo,
DataTransformerToList<T>? transformerToList) {
if (transformerToList != null) {
return transformerToList(o);
}
if (o == null) return [];
if (o is List) {
if (o.isEmpty) return [];
return o
.map((e) => doTransformTo(e, transformerTo))
.whereType<T>()
.toList();
} else {
return [doTransformTo(o, transformerTo)].whereType<T>().toList();
}
}