toOptions static method

List<OPTIONElement> toOptions(
  1. Object? options
)

Implementation

static List<OPTIONElement> toOptions(Object? options) {
  if (options == null) return [];
  if (options is OPTIONElement) return [options];

  if (options is Map) {
    return options.entries
        .map(OPTIONElement.from)
        .whereType<OPTIONElement>()
        .toList();
  } else if (options is Iterable) {
    return options
        .map(OPTIONElement.from)
        .whereType<OPTIONElement>()
        .toList();
  } else {
    return [OPTIONElement.from(options)!];
  }
}