# PreConstruct class

Marks a method to be invoked before a pod has been fully constructed and its dependencies injected, but before it is made available for use in the context.

This is typically used for:

- Initialization logic that depends on injected fields.
- Validating configuration.
- Opening resources (like database connections).

### Rules

- Must be a no-arg method.
- Return type should be `void` or `Future<void>`.
- Only applied to methods (not classes or fields).

### Example — Synchronous Initialization

    @Service()
    class CacheManager {
      final _cache = <String, String>{};

      void put(String key, String value) => _cache[key] = value;

      @PreConstruct()
      void init() {
        print("Initializing cache from database...");
        _cache = Cache.loadFrom(dataSource);
      }
    }

### Example — Asynchronous Initialization

    @Service()
    class WorkerPool {
      final _workers = <Worker>[];

      @PreConstruct()
      Future<void> initWorkers() async {
        for (final worker in _workers) {
          await worker.start();
        }
      }
    }

Inheritance
  - Object
  - ReflectableAnnotation
  - PreConstruct
Annotations
  - @Target({TargetKind.method})

## Constructors

PreConstruct.new()
  Marks a method to be invoked before a pod has been fully constructed and its dependencies injected, but before it is made available for use in the context.
  const

## Properties

annotationType → Type
  Returns the annotation _type of this annotation.
  no setter override
hashCode → int
  Returns a hash code consistent with equality definition.
  no setter inherited
runtimeType → Type
  A representation of the runtime type of the object.
  no setter inherited

## Methods

equals(Object other) → bool
  Checks whether the given object is logically equivalent to this annotation.
  inherited
noSuchMethod(Invocation invocation) → dynamic
  Invoked when a nonexistent method or property is accessed.
  inherited
toString() → String
  Returns a string representation of this annotation.
  inherited

## Operators

operator ==(Object other) → bool
  Checks if this annotation is equal to another object.
  inherited