getEdgesByNode method

List<InfiniteCanvasNode> getEdgesByNode(
  1. InfiniteCanvasNode node
)

Implementation

List<InfiniteCanvasNode> getEdgesByNode(InfiniteCanvasNode node) {
  return edges
      .where((edge) {
        return edge.from.toString() == node.key.toString() ||
            edge.to.toString() == node.key.toString();
      })
      .map((edge) {
        final from = getNodeById(edge.from.toString());
        final to = getNodeById(edge.to.toString());
        return [from, to];
      })
      .expand((element) => element)
      .whereNotNull()
      .toList();
}