listInt method

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

get value as int

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

Implementation

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