toJsonMap method

  1. @override
Map<String, Object>? toJsonMap({
  1. O? obj,
  2. JsonEncoder? jsonEncoder,
})
override

Returns a enum instance as a JSON Map.

Implementation

@override
Map<String, Object>? toJsonMap({O? obj, JsonEncoder? jsonEncoder}) {
  obj ??= object;
  if (obj == null) return null;

  var name = getName(obj)!;
  var index = getIndex(obj)!;

  return {'name': name, 'index': index};
}