# ScopedObjectFactory<T> class

An ObjectFactory implementation that retrieves objects from a specific PodScope.

This factory combines a pod scope with a fallback factory to provide scope-aware object retrieval. It first attempts to get the object from the specified scope, and if not found, uses the fallback factory to create and register the object in the scope.

Key features:

- Scope-aware object retrieval and creation
- Lazy initialization with fallback factory
- Thread-safe scope operations
- Support for various scope types (singleton, prototype, request, session, etc.)
- Integration with scope lifecycle management

This is particularly useful for:

- Managing objects with specific lifecycle requirements
- Handling request-scoped or session-scoped objects
- Implementing custom scope strategies
- Integrating with web frameworks and other scope-aware environments

Example usage:

    // Create a fallback factory for UserService
    final fallbackFactory = () {
      final service = UserService();
      service.initialize();
      return service;
    };

    // Create a scoped factory for request scope
    final scopedFactory = ScopedObjectFactory<UserService>(
      'userService',
      requestScope,
      fallbackFactory,
    );

    // Get the UserService instance from the scope
    final userService = scopedFactory.getObject();

Inheritance
  - Object
  - ObjectFactory<T>
  - ScopedObjectFactory
Annotations
  - @Generic(ScopedObjectFactory)

## Constructors

ScopedObjectFactory.new(String name, PodScope scope, ObjectFactory<T> fallbackFactory)
  An ObjectFactory implementation that retrieves objects from a specific PodScope.

## Properties

fallbackFactory → ObjectFactory<T>
  The fallback factory used to create the object if it doesn't exist in the scope.
  final
hashCode → int
  The hash code for this object.
  no setter inherited
name → String
  The name of the pod to retrieve or create in the scope.
  final
runtimeType → Type
  A representation of the runtime type of the object.
  no setter inherited
scope → PodScope
  The pod scope from which to retrieve or register the object.
  final

## Methods

chain<R>(ObjectFactory<R> nextFactory(T)) → Future<ObjectFactory<R>>
  Creates a new ObjectFactory that uses this factory's output as input to another factory.
  inherited
copyWith({ObjectFactoryFunction<T>? creator}) → ObjectFactory<T>
  Creates a copy of this ObjectFactory with a new creator function.
  inherited
copyWithScope({String? name, PodScope? scope, ObjectFactory<T>? fallbackFactory}) → ScopedObjectFactory<T>
  Creates a copy of this ScopedObjectFactory with optional modifications.
createMultiple(int count) → Future<List<T>>
  Creates multiple instances of type `T` in a single call.
  inherited
get([List<ArgumentValue>? args]) → FutureOr<ObjectHolder<T>>
  Returns an instance of the object managed by this factory.
  override
getPodName() → String
  Returns the pod name used by this factory.
noSuchMethod(Invocation invocation) → dynamic
  Invoked when a nonexistent method or property is accessed.
  inherited
removeFromScope() → T?
  Removes the object from the scope if it exists.
toString() → String
  Returns a string representation of this ScopedObjectFactory.
  override
withSideEffect(void sideEffect(T)) → Future<ObjectFactory<T>>
  Creates a new factory that performs a side effect after object creation.
  inherited

## Operators

operator ==(Object other) → bool
  The equality operator.
  inherited