ZenProvider constructor

const ZenProvider({
  1. Key? key,
  2. required Widget child,
  3. ZenScope? scope,
  4. ZenModule moduleBuilder()?,
  5. String? scopeName,
})

Creates a ZenProvider that provides a scope to its descendants.

Either scope or moduleBuilder must be provided, but not both.

Implementation

const ZenProvider({
  super.key,
  required this.child,
  this.scope,
  this.moduleBuilder,
  this.scopeName,
})  : assert(
          scope != null || moduleBuilder != null,
          'ZenProvider requires either a scope or a moduleBuilder. '
          'Use ZenProvider(moduleBuilder: () => MyModule(), child: ...) '
          'or ZenProvider.create<T>(create: ..., child: ...) for a single controller.'),
      assert(!(scope != null && moduleBuilder != null),
          'ZenProvider: provide scope OR moduleBuilder, not both.');