VectorDefinition.fromDisplay constructor

VectorDefinition.fromDisplay(
  1. String displayString
)

Implementation

factory VectorDefinition.fromDisplay(String displayString) {
  final parts = displayString
      .replaceAll('(', '')
      .replaceAll(')', '')
      .split(',')
      .map((e) => e.trim())
      .toList();
  final x = int.parse(parts[0]);
  final y = int.parse(parts[1]);
  return VectorDefinition(x, y);
}