encodeJsonTree method

  1. @override
Object? encodeJsonTree(
  1. double instance
)
override

Converts instance to a JSON tree.

Before calling this method, you should call isInstance to check whether instance is an instance of T .

Implementation

@override
Object? encodeJsonTree(double instance) {
  if (instance.isNaN) {
    return 'NaN';
  }
  if (instance.isInfinite) {
    if (instance.isNegative) {
      return '-Infinity';
    }
    return 'Infinity';
  }
  if (instance == -0.0 && !negativeZeroes) {
    instance = 0.0;
  }
  return instance;
}