call method
- UpdateNodeParams? params,
override
Executes the use case with optional parameters.
Returns a Future that completes with the result of type T.
Implementations should handle errors appropriately.
Implementation
@override
Future<ElectricalNode> call({UpdateNodeParams? params}) async {
if (params == null) throw Exception("Params required");
final newRoot =
_updateNodeInTree(params.root, params.targetId, params.updateFn);
if (newRoot == null) {
throw Exception("Target node ${params.targetId} not found");
}
return newRoot;
}