encodeJsonTree method

  1. @override
String encodeJsonTree(
  1. T 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
String encodeJsonTree(T instance) {
  final s = nameOf(instance);
  if (s == null) {
    throw StateError('Invalid value: $instance');
  }
  return s;
}