onSasCancelled method

void onSasCancelled(
  1. dynamic event
)

Implementation

void onSasCancelled(VerificationEvent event) {
  _log.info('emitter sas.cancelled');
  if (flowId == null) {
    return; // already finished due to request.cancelled happened just before
  }
  setState(() => flowId = null);

  // close dialog from previous stage, ex: sas.keys_exchanged
  final nav = Navigator.of(context, rootNavigator: true);
  if (nav.canPop()) nav.pop();

  // [ref] https://spec.matrix.org/unstable/client-server-api/#mkeyverificationcancel
  var reason = event.getContent('reason');
  if (reason == 'Unknown cancel reason') {
    reason = null;
  }
  // open sas.cancelled dialog
  showModalBottomSheet(
    context: context,
    builder: (BuildContext context) => SasCancelledView(
      sender: event.sender(),
      isVerifier: isVerifier,
      message: reason,
      onDone: onFlowFinished,
    ),
    isDismissible: false,
  );
}