RefenaContainer constructor

RefenaContainer({
  1. PlatformHint platformHint = PlatformHint.unknown,
  2. List<ProviderOverride<BaseNotifier, dynamic>> overrides = const [],
  3. List<BaseProvider<BaseNotifier, dynamic>> initialProviders = const [],
  4. NotifyStrategy defaultNotifyStrategy = NotifyStrategy.equality,
  5. List<RefenaObserver> observers = const [],
  6. bool initImmediately = true,
})

Creates a RefenaContainer.

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 is used to observe events. The initImmediately defines whether the container should be initialized right away.

Implementation

RefenaContainer({
  this.platformHint = PlatformHint.unknown,
  List<ProviderOverride> overrides = const [],
  List<BaseProvider> initialProviders = const [],
  this.defaultNotifyStrategy = NotifyStrategy.equality,
  List<RefenaObserver> observers = const [],
  bool initImmediately = true,
})  : _overrides = _overridesToMap(overrides),
      _overridesList = overrides,
      _initialProviders = initialProviders,
      observer = _observerListToSingleObserver(observers) {
  if (initImmediately) {
    init();
  }
}