toJSONValue method

J toJSONValue()

Returns the converted value ready for JSON.

Implementation

J toJSONValue() {
  if (valueToJSON != null) return valueToJSON!(value);
  if (value is BigInt || value is BigInt?) {
    return _toSpecificType<BigInt>(value, (value) => value.toInt());
  }
  if (value is DateTime || value is DateTime?) {
    return _toSpecificType<DateTime>(
      value,
      (value) => value.toIso8601String(),
    );
  }
  return value as J;
}