readIterableOfString method

Iterable<String> readIterableOfString(
  1. Iterable<String> pathSegments, {
  2. bool packageRelated = false,
})

Implementation

Iterable<String> readIterableOfString(
  Iterable<String> pathSegments, {
  bool packageRelated = false,
}) {
  final usedSegments =
      packageRelated ? [_rootKey, ...pathSegments] : pathSegments;

  Object? data = options;

  for (final key in usedSegments) {
    if (data is Map<String, Object> && data.containsKey(key)) {
      data = data[key];
    } else {
      return [];
    }
  }

  return isIterableOfStrings(data) ? (data as Iterable).cast<String>() : [];
}