toStringAsFixed method

String toStringAsFixed(
  1. int fractionDigits
)

Prints the x and y values of this InterpolationNode instance with fractionDigits decimal digits. The output produced by this method is the same that would result in calling toStringAsFixed on a double. For example:

const example = InterpolationNode(
  x: 5.123,
  y: 8.123,
);

// Calling 'toStringAsFixed' on the `InterpolationNode` object
print(example.toStringAsFixed(1)); // (5.1, 8.1)

// The same result but with 'toStringAsFixed' calls on 'x' and 'y' values
final x = example.x.toStringAsFixed(1);
final y = example.y.toStringAsFixed(1);

print("$x, $y"); // (5.1, 8.1)

Implementation

String toStringAsFixed(int fractionDigits) {
  final xValue = x.toStringAsFixed(fractionDigits);
  final yValue = y.toStringAsFixed(fractionDigits);

  return '($xValue, $yValue)';
}