initialize method

  1. @override
FutureOr<InitializationResult> initialize()
override

Initialization implementation. Do not call it directly, use doInitialization.

It can be a synchronous (returning an InitializationResult) or an asynchronous implementation (returning a Future). A thrown error, or an InitializationResult.error, fails the initialization.

The returned InitializationResult.dependencies are initialized after this (post-dependencies). A result of another Initializable makes it a post-dependency too (its dependencies are reported as this one's).

See initializeDependencies.

Implementation

@override
FutureOr<InitializationResult> initialize() => provider
    .executeInitialized(
      () => repositoryAdapter.ensureInitialized(parent: this),
      parent: this,
    )
    // Its dependencies: the adapter and its repository adapter (not their
    // dependencies, e.g. all the repositories: already waited by the
    // adapter, and a clique of every repository waiting for every other).
    .resolveMapped(
      (_) => InitializationResult.ok(
        this,
        dependencies: [provider, repositoryAdapter],
      ),
    );