Here is the code snippet:
body: MultiBlocProvider(
providers: [
BlocProvider(
create: (context) => StripeProductCollectionCubit(
productId: productModel.selfRef.id,
collectionRef: context
.read<FirestoreRepository>()
.firestore
.collection('stripeProducts')),
),
BlocProvider(create: (context) => StripeCheckoutCubit())
],
child: BlocListener<StripeCheckoutCubit, StripeCheckoutState>(
listener: (context, state) async {
if (state
is StripeCheckoutInitiationSuccess<CheckoutSessionModel>) {
final checkoutModelUrl = state.checkoutData.url;
final launchCheckoutUrl = Uri.parse(checkoutModelUrl);
if (await canLaunchUrl(launchCheckoutUrl)) {
launchUrl(launchCheckoutUrl,
mode: LaunchMode.externalApplication);
} else {
debugPrint('Cannot launch website Url');
}
}
},
Why is bloc listener not being called? The state emits success, which was verified.