ilistOf<A> static method

Decoder<IList<A>> ilistOf<A>(
  1. Decoder<A> elementDecoder
)

Implementation

static Decoder<IList<A>> ilistOf<A>(Decoder<A> elementDecoder) {
  elementDecoder.key.forEach(
    (key) =>
        // ignore: avoid_print
        print('warn: Passing a keyed ($key) decoder to an [i]List decoder.'),
  );

  return _primitive<List<dynamic>>().flatMap(
    (list) => Decoder._unkeyed(
      (_) => IList.sequenceEither(
        IList.from(list.map(elementDecoder.decode)),
      ),
    ),
  );
}