createOrModifyCoding method

  1. @override
Future<Coding?> createOrModifyCoding(
  1. Coding coding
)
override

Create or update a Coding

When modifying a coding, you must ensure that the rev obtained when getting or creating the coding is present as the rev is used to guarantee that the coding has not been modified by a third party.

Parameters:

Implementation

@override
Future<Coding?> createOrModifyCoding(Coding coding) async =>
    (await (coding.rev?.let((it) => api.baseCodeApi.modifyCode(coding.toCodeDto())) ?? api.baseCodeApi.createCode(coding.toCodeDto())))?.toCoding();