parseNumber method

  1. @override
Int64? parseNumber(
  1. String? input
)
override

Coerces the String value of the MaterialInput into type of T.

Implementation

@override
Int64? parseNumber(String? input) {
  if (input == null || input.isEmpty) {
    return null;
  }

  try {
    // If using formatting, we must firsrt parse back to a non-formatted
    // String representation as Int64 cannot handle commas.
    if (_numberFormat != null) {
      input = _numberFormat!.parse(input).toString();
    }

    return Int64.parseInt(input);
  } on FormatException {
    return null;
  }
}