isNumber function

bool isNumber(
  1. String? input
)

Returns true if input is a base-10 integer (surrounding whitespace is trimmed first). Parsing is pinned to radix: 10, so the 0x hex prefix, scientific notation and decimals are all rejected — use isDecimal for fractional values.

Implementation

bool isNumber(String? input) =>
    int.tryParse(input?.trim() ?? '', radix: 10) != null;