suggestions method

  1. @override
List<String> suggestions(
  1. String key
)
override

Returns a list of suggestions for the given key.

This is useful when optional configuration might exist.

Example:

final suggestions = resolver.suggestions('app.name');

Implementation

@override
List<String> suggestions(String key) {
  List<String> suggestions = [];
  if (propertySources case final sources?) {
    for (final propertySource in sources) {
      if (propertySource.getName().contains(key) || propertySource.getName().equals(key)) {
        suggestions.add(propertySource.getName());
      }
    }
  }

  return suggestions;
}