RefenaScope.withContainer constructor

RefenaScope.withContainer({
  1. Key? key,
  2. required RefenaContainer container,
  3. PlatformHint? platformHint,
  4. bool ownsContainer = true,
  5. bool defaultRef = true,
  6. required Widget child,
})

Creates a RefenaScope that uses an existing RefenaContainer. By default, the RefenaScope will dispose the RefenaContainer when the RefenaScope itself is disposed. To prevent this, set ownsContainer to false.

Implementation

factory RefenaScope.withContainer({
  Key? key,
  required RefenaContainer container,
  PlatformHint? platformHint,
  bool ownsContainer = true,
  bool defaultRef = true,
  required Widget child,
}) {
  return RefenaScope._(
    key: key,
    container: container
      ..platformHint = platformHint ??
          (container.platformHint == PlatformHint.unknown
              ? RefenaScope.getPlatformHint()
              : container.platformHint),
    implicitContainer: false,
    ownsContainer: ownsContainer,
    defaultRef: defaultRef,
    child: child,
  );
}