unLink method

bool unLink(
  1. dynamic a,
  2. dynamic b, {
  3. List anyTags = const [],
  4. List allTags = const [],
})
override

Remove the link between 2 nodes

(Optional) Only if it matches any of anyTags and matches all items in allTags

Implementation

bool unLink(a, b, {List anyTags = const [], List allTags = const []}) {
  return _Tuple2(a, b)
      .map((v) => _map_add_or_get(v, _newNode))
      .where((t) => t
          .mutual((f, t) => _check_hasTo_and_all_any_tags(f, t,
              anyTags: anyTags, allTags: allTags))
          .toDo(_or))
      .some((t) => t
          .fork()
          .mapFn<bool Function(_Node, _Node), _Tuple2<bool>>(
              (t) => (fn) => t.mutual(fn))
          // unsetTo will delete the edge and tab
          .allDo((f, t) => f.unsetTo(t), (f, t) => f.unsetFrom(t))
          .map((t) => t.toDo(_or))
          .toDo(_or))
      .defaultVal(false)
      .val!;
}