added maybeOf getter for iap stub

This commit is contained in:
Vadim 2023-11-02 17:15:39 +01:00
parent 73ebc671f2
commit 77bbeca92e

View file

@ -6,8 +6,10 @@ class IAPProductsProvider extends StatefulWidget {
const IAPProductsProvider({required this.child, super.key});
static IAPProductsProviderState of(BuildContext context) {
return context.findAncestorStateOfType<IAPProductsProviderState>()!;
static IAPProductsProviderState of(BuildContext context) => IAPProductsProvider.maybeOf(context)!;
static IAPProductsProviderState? maybeOf(BuildContext context) {
return context.findAncestorStateOfType<IAPProductsProviderState>();
}
@override
@ -54,8 +56,7 @@ class IAPProducts extends InheritedModel<IAPProductType> {
bool updateShouldNotify(IAPProducts oldWidget) => false;
@override
bool updateShouldNotifyDependent(IAPProducts oldWidget, Set<IAPProductType> dependencies) =>
false;
bool updateShouldNotifyDependent(IAPProducts oldWidget, Set<IAPProductType> dependencies) => false;
IAPProduct? _findProduct(IAPProductType type) {
try {