feat: modify api in CherryPickProvider

This commit is contained in:
Sergey Penkovsky
2025-05-03 17:02:13 +03:00
parent 35f7c27360
commit 3d3130914a

View File

@@ -14,14 +14,15 @@ import 'package:flutter/widgets.dart';
/// limitations under the License. /// limitations under the License.
/// ///
class CherryPickProvider extends InheritedWidget { final class CherryPickProvider extends InheritedWidget {
// Holds a reference to the root scope object Scope openRootScope() => CherryPick.openRootScope();
final Scope rootScope;
Scope openSubScope({String scopeName = '', String separator = '.'}) =>
CherryPick.openScope(scopeName: scopeName, separator: separator);
// Constructor for CherryPickProvider. Initializes with a required rootScope and child widget. // Constructor for CherryPickProvider. Initializes with a required rootScope and child widget.
const CherryPickProvider({ const CherryPickProvider({
super.key, super.key,
required this.rootScope,
required super.child, required super.child,
}); });
@@ -38,7 +39,6 @@ class CherryPickProvider extends InheritedWidget {
// Determines whether the widget should notify dependents when it changes // Determines whether the widget should notify dependents when it changes
@override @override
bool updateShouldNotify(CherryPickProvider oldWidget) { bool updateShouldNotify(CherryPickProvider oldWidget) {
// Notify if the rootScope has changed return false;
return rootScope != oldWidget.rootScope;
} }
} }