toJson method

dynamic toJson ({bool withData: true })

Converts this ParseObject into Map

Implementation

dynamic toJson({bool withData = true}) {
  final map = <String, dynamic>{
    keyClassName: className,
  };

  if (_objectId != null) {
    map[keyObjectId] = _objectId;
  }

  if (withData) {
    if (_createdAt != null && _updatedAt != null) {
      map[keyCreatedAt] = parseDateFormat.format(_createdAt);
      map[keyUpdatedAt] = parseDateFormat.format(_updatedAt);
    }

    _data.forEach((key, value) {
      map[key] = parseEncoder.encode(value);
    });

    map[keyComplete] = _isComplete;
    map[keyIsDeletingEventually] = _isDeletingEventually;
    map[keySelectedKeys] = _selectedKeys;
    map[keyOperations] = _operations;
  }

  return map;
}