phoneCallAnoymizer function Null safety

PhoneCall phoneCallAnoymizer(
  1. PhoneCall call
)

A PhoneCall anonymizer function. Anonymizes:

  • formattedNumber
  • number
  • name

Implementation

PhoneCall phoneCallAnoymizer(PhoneCall call) {
  if (call.formattedNumber != null)
    call.formattedNumber =
        sha1.convert(utf8.encode(call.formattedNumber!)).toString();
  if (call.number != null)
    call.number = sha1.convert(utf8.encode(call.number!)).toString();
  if (call.name != null)
    call.name = sha1.convert(utf8.encode(call.name!)).toString();

  return call;
}