toJSON method

  1. @override
dynamic toJSON(
  1. Object? object,
  2. SerializationContext context
)
override

Implementation

@override
dynamic toJSON(Object? object, SerializationContext context) {
  final format = getNumberFormat(context.jsonPropertyMeta);
  return object != null && format != null
      ? getNumberFormat(context.jsonPropertyMeta)!.format(object)
      : (object is String)
          ? num.tryParse(object)
          : object;
}