encodeCollectionQueryParameter<T> function

ListParam<Object?> encodeCollectionQueryParameter<T>(
  1. Serializers serializers,
  2. dynamic value,
  3. FullType type, {
  4. ListFormat format = ListFormat.multi,
})

Implementation

ListParam<Object?> encodeCollectionQueryParameter<T>(
  Serializers serializers,
  dynamic value,
  FullType type, {
  ListFormat format = ListFormat.multi,
}) {
  final serialized = serializers.serialize(
    value as Object,
    specifiedType: type,
  );
  if (value is BuiltList<T> || value is BuiltSet<T>) {
    return ListParam(List.of((serialized as Iterable<Object?>).cast()), format);
  }
  throw ArgumentError('Invalid value passed to encodeCollectionQueryParameter');
}