fixed showBuyProDialog test

This commit is contained in:
Vadim 2024-01-27 22:39:48 +01:00
parent 40e4340bc9
commit 4425c47b69
2 changed files with 6 additions and 4 deletions

View file

@ -31,8 +31,10 @@ class ServicesProvider extends InheritedWidget {
required super.child, required super.child,
}); });
static ServicesProvider of(BuildContext context) { static ServicesProvider of(BuildContext context) => ServicesProvider.maybeOf(context)!;
return context.findAncestorWidgetOfExactType<ServicesProvider>()!;
static ServicesProvider? maybeOf(BuildContext context) {
return context.findAncestorWidgetOfExactType<ServicesProvider>();
} }
@override @override

View file

@ -46,8 +46,8 @@ class ProFeaturesDialog extends StatelessWidget {
FilledButton( FilledButton(
onPressed: () { onPressed: () {
_close(context).then((_) { _close(context).then((_) {
ServicesProvider.of(context) ServicesProvider.maybeOf(context)
.analytics ?.analytics
.setCustomKey('iap_product_type', IAPProductType.paidFeatures.storeId); .setCustomKey('iap_product_type', IAPProductType.paidFeatures.storeId);
IAPProductsProvider.maybeOf(context)?.buy(IAPProductType.paidFeatures); IAPProductsProvider.maybeOf(context)?.buy(IAPProductType.paidFeatures);
}); });