updateMaxTs method

Future<WaterLineFieldDto> updateMaxTs(
  1. ChangeType changeType,
  2. int? localTs,
  3. int? remoteTs
)

Implementation

Future<WaterLineFieldDto> updateMaxTs(
    ChangeType changeType, int? localTs, int? remoteTs) async {
  if (!initialized) throw ArgumentError(AbstractDao.C_MUST_INIT);
  WaterLineFieldDto tmpWaterLineFieldDto;
  try {
    tmpWaterLineFieldDto = await waterLineFieldDao.getMaxDto(changeType);
    if (localTs != null && tmpWaterLineFieldDto.local_ts != null) {
      if (localTs < tmpWaterLineFieldDto.local_ts!) localTs = null;
    }
    if (remoteTs != null && tmpWaterLineFieldDto.remote_ts != null) {
      if (remoteTs < tmpWaterLineFieldDto.remote_ts!) remoteTs = null;
    }
  } on SqlException catch (e) {
    if (e.sqlExceptionEnum != SqlExceptionEnum.ENTRY_NOT_FOUND) rethrow;
  }

  return waterLineFieldDao.setMaxTs(changeType, localTs, remoteTs);
}