getsOrNull<T extends Object?> static method

List<T>? getsOrNull<T extends Object?>(
  1. String key, {
  2. String? path,
  3. List<T>? defaultValue,
  4. EnvironmentType? environment,
  5. PlatformType? platform,
  6. T? parser(
    1. Object?
    )?,
  7. T? modifier(
    1. T
    )?,
})

Implementation

static List<T>? getsOrNull<T extends Object?>(
  String key, {
  String? path,
  List<T>? defaultValue,
  EnvironmentType? environment,
  PlatformType? platform,
  T? Function(Object?)? parser,
  T? Function(T)? modifier,
}) {
  try {
    final raw = i._select(
      key,
      path: path,
      environment: environment,
      platform: platform,
    );
    List<T>? value = raw.findsOrNull(builder: parser);
    value ??= defaultValue;
    if (modifier != null) {
      value = value?.map(modifier).whereType<T>().toList();
    }
    return value;
  } catch (msg) {
    i._log(msg);
    return defaultValue;
  }
}