toJson method

  1. @override
String? toJson([
  1. O? obj,
  2. JsonEncoder? jsonEncoder
])
override

Returns a enum instance as a JSON value.

Implementation

@override
String? toJson([O? obj, JsonEncoder? jsonEncoder]) {
  obj ??= object;
  if (obj == null) {
    return null;
  }

  if (jsonEncoder == null) {
    var name = getName(obj);
    return name;
  } else {
    return jsonEncoder.toJson(obj, autoResetEntityCache: false);
  }
}