loadBudget method

Future<void> loadBudget(
  1. ElectricalNode? root, {
  2. BudgetConfig? config,
})

Implementation

Future<void> loadBudget(ElectricalNode? root, {BudgetConfig? config}) async {
  if (root == null) return;

  // Calculate items
  final items = await pricingEngine.calculateBudget(root, config: config);

  // Calculate net total
  double total = 0;
  for (var item in items) {
    total += item.total;
  }

  emit(state.copyWith(items: items, netTotal: total));
}