getValues<S> method

List<S> getValues<S>(
  1. S? getValue(
    1. T
    )
)

Implementation

List<S> getValues<S>(S? Function(T) getValue) {
  return _childrenIndexes.entries
      // Sort keys by index.
      .sorted((a, b) => a.value.compareTo(b.value))
      .where((e) => _childrenModels[e.key] != null)
      // Map each model to the desired value and return as list. In order
      // to preserve index order, rather than removing null values we provide
      // default values (for types with reasonable defaults).
      .map((e) => getValue(_childrenModels[e.key]!) ?? _getDefaultValue<S>()!)
      .toList();
}