decodeInt method
Implementation
@override
int decodeInt(dynamic e, {String? name}) {
try {
return switch (e) {
int() => e,
double() when e.toInt() == e => e.toInt(),
String() => int.parse(e),
_ => throw CodecException.typeMismatch(int, e.runtimeType, name),
};
} on FormatException catch (_) {
throw CodecException.typeMismatch(int, e.runtimeType, name);
}
}