paymentSheetEvents property
latefinal
Typed application-facing lifecycle events for the active payment sheet.
Subscribe before presenting the sheet so the first event is not missed. A failed attempt is recoverable and does not complete presentPaymentSheet.
Implementation
late final Stream<PaymentSheetEvent> paymentSheetEvents =
_eventChannel.receiveBroadcastStream().map((value) {
if (value is! Map) {
throw const FormatException(
'Native payment sheet returned an invalid lifecycle event',
);
}
return PaymentSheetEvent.fromJson(Map<Object?, Object?>.from(value));
}).asBroadcastStream();