diff --git a/lib/providers/services_provider.dart b/lib/providers/services_provider.dart index 36f5674..1db019e 100644 --- a/lib/providers/services_provider.dart +++ b/lib/providers/services_provider.dart @@ -31,8 +31,10 @@ class ServicesProvider extends InheritedWidget { required super.child, }); - static ServicesProvider of(BuildContext context) { - return context.findAncestorWidgetOfExactType()!; + static ServicesProvider of(BuildContext context) => ServicesProvider.maybeOf(context)!; + + static ServicesProvider? maybeOf(BuildContext context) { + return context.findAncestorWidgetOfExactType(); } @override diff --git a/lib/screens/shared/pro_features_dialog/widget_dialog_pro_features.dart b/lib/screens/shared/pro_features_dialog/widget_dialog_pro_features.dart index 50cca42..3b8d4f2 100644 --- a/lib/screens/shared/pro_features_dialog/widget_dialog_pro_features.dart +++ b/lib/screens/shared/pro_features_dialog/widget_dialog_pro_features.dart @@ -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); });