addTest<MInstance extends MvvmInstance> method

  1. @visibleForTesting
void addTest<MInstance extends MvvmInstance>({
  1. String scope = BaseScopes.global,
  2. required MvvmInstance instance,
  3. dynamic params,
  4. bool overrideMainInstance = true,
})

Adds test instance for given instance type

Used only for tests

scope - string scope value instance - given instance to add params - params for this instance

Implementation

@visibleForTesting
void addTest<MInstance extends MvvmInstance>({
  String scope = BaseScopes.global,
  required MvvmInstance instance,
  dynamic params,
  bool overrideMainInstance = true,
}) {
  final id = MInstance.toString();

  container.addObjectInScope(
    object: instance,
    type: id,
    scopeId: scope,
    overrideMainInstance: overrideMainInstance,
  );

  if (!instance.isInitialized) {
    instance.initialize(params);
  }
}