Skip to content
pubscout

sankey_flutter

0.0.3, released 11 months ago by an unverified publisher

Flutter package for rendering interactive Sankey diagrams with gradient links and d3 layout.

WASM-ready
$ flutter pub add sankey_flutter
Source repository

What it does

Provides widgets and helpers for rendering flow diagrams using the d3-sankey layout algorithm directly in Flutter. It supports gradient links, node selection, custom node widths, padding, and toggleable labels.

AI-written summary of version 0.0.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to display a Sankey diagram showing flow values and node connections.
  • You want interactive node selection with callbacks and HSL selection borders.

Skip it when

  • You need standard charts like line, bar, or pie charts instead of node-link flow diagrams.

Strengths

  • Adapts the proven d3-sankey layout algorithm into Dart.
  • Supports smooth gradient links and texture overlays.
  • Includes responsive design support via LayoutBuilder.

Weaknesses

  • Limited to Sankey flow diagrams.
  • Early version (0.0.3) with potentially evolving APIs.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:flutter/material.dart';
import 'package:sankey_flutter/sankey_helpers.dart';
import 'package:sankey_flutter/sankey_node.dart';
import 'package:sankey_flutter/sankey_link.dart';

final nodes = [
  SankeyNode(id: 0, label: 'Source A'),
  SankeyNode(id: 1, label: 'Target'),
];
final links = [
  SankeyLink(source: nodes[0], target: nodes[1], value: 100),
];
final nodeColors = generateDefaultNodeColorMap(nodes);
final dataSet = SankeyDataSet(nodes: nodes, links: links);
final sankey = generateSankeyLayout(width: 600, height: 400);
dataSet.layout(sankey);

SankeyDiagramWidget(
  data: dataSet,
  nodeColors: nodeColors,
  size: Size(600, 400),
);