Tree<T, D> constructor

Tree<T, D>({
  1. required String id,
  2. required TreeNode<T> root,
  3. required TypedAccessorFn<T, D> domainFn,
  4. required TypedAccessorFn<T, num?> measureFn,
  5. TypedAccessorFn<T, Color>? colorFn,
  6. TypedAccessorFn<T, Color>? fillColorFn,
  7. TypedAccessorFn<T, Color>? patternColorFn,
  8. TypedAccessorFn<T, FillPatternType>? fillPatternFn,
  9. TypedAccessorFn<T, num>? strokeWidthPxFn,
  10. TypedAccessorFn<T, String>? labelFn,
  11. TypedAccessorFn<T, TextStyleSpec>? labelStyleFn,
})

Implementation

factory Tree({
  required String id,
  required TreeNode<T> root,
  required TypedAccessorFn<T, D> domainFn,
  required TypedAccessorFn<T, num?> measureFn,
  TypedAccessorFn<T, Color>? colorFn,
  TypedAccessorFn<T, Color>? fillColorFn,
  TypedAccessorFn<T, Color>? patternColorFn,
  TypedAccessorFn<T, FillPatternType>? fillPatternFn,
  TypedAccessorFn<T, num>? strokeWidthPxFn,
  TypedAccessorFn<T, String>? labelFn,
  TypedAccessorFn<T, TextStyleSpec>? labelStyleFn,
}) {
  return Tree._(
    id: id,
    root: root,
    domainFn: _castFrom<T, D>(domainFn)!,
    measureFn: _castFrom<T, num?>(measureFn)!,
    colorFn: _castFrom<T, Color>(colorFn),
    fillColorFn: _castFrom<T, Color>(fillColorFn),
    fillPatternFn: _castFrom<T, FillPatternType>(fillPatternFn),
    patternColorFn: _castFrom<T, Color>(patternColorFn),
    strokeWidthPxFn: _castFrom<T, num>(strokeWidthPxFn),
    labelFn: _castFrom<T, String>(labelFn),
    labelStyleFn: _castFrom<T, TextStyleSpec>(labelStyleFn),
  );
}