2025-08-06 16:21:31 +03:00
|
|
|
import 'package:cherrypick/cherrypick.dart';
|
|
|
|
|
|
2025-08-06 23:15:28 +03:00
|
|
|
/// Abstraction for Dependency Injection (DI) Adapter.
|
|
|
|
|
///
|
|
|
|
|
/// Provides a uniform interface to setup, resolve, and teardown DI containers/modules
|
|
|
|
|
/// and open sub-scopes to benchmark them under different libraries.
|
2025-08-06 16:21:31 +03:00
|
|
|
abstract class DIAdapter {
|
2025-08-06 23:15:28 +03:00
|
|
|
/// Installs the provided modules into the DI container.
|
2025-08-06 16:21:31 +03:00
|
|
|
void setupModules(List<Module> modules);
|
2025-08-06 23:15:28 +03:00
|
|
|
|
|
|
|
|
/// Resolves an instance of type [T] by optional [named] tag.
|
2025-08-06 16:21:31 +03:00
|
|
|
T resolve<T>({String? named});
|
2025-08-06 23:15:28 +03:00
|
|
|
|
|
|
|
|
/// Asynchronously resolves an instance of type [T] by optional [named] tag.
|
2025-08-06 16:21:31 +03:00
|
|
|
Future<T> resolveAsync<T>({String? named});
|
2025-08-06 23:15:28 +03:00
|
|
|
|
|
|
|
|
/// Tears down or disposes of the DI container.
|
2025-08-06 16:21:31 +03:00
|
|
|
void teardown();
|
2025-08-06 23:15:28 +03:00
|
|
|
|
|
|
|
|
/// Opens a child DI sub-scope, useful for override/child-scope benchmarks.
|
2025-08-06 16:21:31 +03:00
|
|
|
DIAdapter openSubScope(String name);
|
|
|
|
|
}
|