cryptoExchange<DV> static method

void cryptoExchange<DV>({
  1. required DV defaultValue,
  2. required void changeValue(
    1. DV defaultValue
    ),
  3. bool isThrowOnError = false,
})

Implementation

static void cryptoExchange<DV>({
  required DV defaultValue,
  required void Function(DV defaultValue) changeValue,
  bool isThrowOnError = false,
}) {
  if (defaultValue == null) {
    return;
  }
  try {
    changeValue(defaultValue);
  } catch (e) {
    if (isThrowOnError) {
      rethrow;
    }
  }
}