RefenaScope constructor

RefenaScope({
  1. Key? key,
  2. PlatformHint? platformHint,
  3. List<ProviderOverride<BaseNotifier, dynamic>> overrides = const [],
  4. List<BaseProvider<BaseNotifier, dynamic>> initialProviders = const [],
  5. NotifyStrategy defaultNotifyStrategy = NotifyStrategy.identity,
  6. List<RefenaObserver> observers = const [],
  7. bool defaultRef = true,
  8. required Widget child,
})

Creates a RefenaScope. It will create an implicit RefenaContainer that will be disposed when the RefenaScope is disposed.

The platformHint gives the container a hint about the platform. This abstraction is used by the inspector that does not depend on Flutter.

The overrides are used to override providers with a different value. The initialProviders are used to initialize providers right away. Otherwise, the providers are initialized lazily when they are accessed. The defaultNotifyStrategy defines when widgets and providers are notified to rebuild. The observers are used to observe events. The child is the widget tree that is wrapped by the RefenaScope.

Implementation

RefenaScope({
  Key? key,
  PlatformHint? platformHint,
  List<ProviderOverride> overrides = const [],
  List<BaseProvider> initialProviders = const [],
  NotifyStrategy defaultNotifyStrategy = NotifyStrategy.identity,
  List<RefenaObserver> observers = const [],
  bool defaultRef = true,
  required Widget child,
}) : this._(
        key: key,
        container: RefenaContainer(
          platformHint: platformHint ?? RefenaScope.getPlatformHint(),
          overrides: overrides,
          initialProviders: initialProviders,
          defaultNotifyStrategy: defaultNotifyStrategy,
          observers: observers,
          initImmediately: false,
        ),
        implicitContainer: true,
        ownsContainer: true,
        defaultRef: defaultRef,
        child: child,
      );