listNum method

List<num?>? listNum(
  1. String i, [
  2. bool required = false
])

get value as list of num

if required argument is true then all the list is not null

Implementation

List<num?>? listNum(String i, [bool required = false]) {
  final data = map[i];
  if (data == null) {
    throw HTTPException(422, 'field $i is required');
  }
  return data.map((e) {
    num? i2 = e.toNum();
    if (i2 == null && required) {
      throw HTTPException(422, 'field $i is not a list of numbers');
    }
    return i2;
  }).toList();
}