reconcile method

ConfigReconciliationResult reconcile({
  1. required InitConfig current,
  2. required FlavorSetup updated,
})

Reconciles the current project configuration against the updated flavor configuration.

Returns the cleaned Environment and Firebase configuration together with the detected added and removed targets.

Implementation

ConfigReconciliationResult reconcile(
    {required InitConfig current, required FlavorSetup updated}) {
  final currentTargets = current.flavors.toSet();
  final newTargets = updated.flavors.toSet();

  final added = newTargets.difference(currentTargets).toList()..sort();

  final removed = currentTargets.difference(newTargets).toList()..sort();

  final environment = _reconcileEnvironment(
    current.environment,
    removed,
  );

  final firebase = _reconcileFirebase(
    current.firebase,
    removed,
  );

  return ConfigReconciliationResult(
    environment: environment,
    firebase: firebase,
    addedTargets: added,
    removedTargets: removed,
  );
}