registerMutations method

void registerMutations(
  1. List<MutationNode> nodes
)

Implementation

void registerMutations(List<MutationNode> nodes) {
  final toolsById = {for (final n in nodes) n.statementId: n.toolName};
  _mutations.removeWhere((sid, _) => !toolsById.containsKey(sid));
  for (final MapEntry(key: sid, value: tool) in toolsById.entries) {
    final existing = _mutations[sid];
    if (existing == null) {
      _mutations[sid] = _Mutation(tool);
    } else if (existing.toolName != tool) {
      _mutations[sid] = _Mutation(tool)
        ..result = {'status': 'idle', 'data': null, 'error': null};
    }
  }
  if (_rebuild()) _notify();
}