toStringWithMaxPrecision method

String toStringWithMaxPrecision(
  1. int maxPrecision
)

Stringifies the Vector2 with a maximum precision of maxPrecision.

Implementation

String toStringWithMaxPrecision(int maxPrecision) {
  final precision = pow(10, maxPrecision);
  final truncatedX = (x * precision).truncate() / precision;
  final truncatedY = (y * precision).truncate() / precision;
  return 'Vector2($truncatedX, $truncatedY)';
}