asIntOrThrow method

int asIntOrThrow({
  1. bool roundDouble = false,
  2. bool truncateDouble = false,
})

Returns the picked value as int or throws

Parses the picked value as int. Also tries to parse String as int Set roundDouble to round double to int Set truncateDouble to cut off decimals roundDouble and truncateDouble can not be true at the same time via int.tryParse

Implementation

int asIntOrThrow({bool roundDouble = false, bool truncateDouble = false}) {
  withContext(
    requiredPickErrorHintKey,
    'Use asIntOrNull() when the value may be null/absent at some point (int?).',
  );
  return _parse(roundDouble, truncateDouble);
}