extractIntValue method

  1. @override
int extractIntValue(
  1. dynamic value,
  2. String errMsg
)
override

Extracts and validates an int value. Throws FormatException if value is not a number or not an int.

Implementation

@override
int extractIntValue(dynamic value, String errMsg) {
  if (value is! num) {
    throw FormatException(
      "[JsonConverter] expected int, got ${value.runtimeType} $errMsg",
    );
  }
  if (value is! int) {
    throw FormatException(
      "[JsonConverter] expected int, got ${value.runtimeType} $errMsg",
    );
  }

  return value;
}