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