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,
});
static ServicesProvider of(BuildContext context) {
return context.findAncestorWidgetOfExactType<ServicesProvider>()!;
static ServicesProvider of(BuildContext context) => ServicesProvider.maybeOf(context)!;
static ServicesProvider? maybeOf(BuildContext context) {
return context.findAncestorWidgetOfExactType<ServicesProvider>();
}
@override

View file

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