Rotation.fromString constructor

Rotation.fromString(
  1. String a
)

Implementation

Rotation.fromString(String a) {
  final regex = RegExp(r'<(?<x>[^,]*),(?<y>[^,]*),(?<z>[^,]*),(?<s>[^,]*)>');
  final match = regex.firstMatch(a);

  if (match != null) {
    x = double.parse(match.namedGroup('x') ?? '0');
    y = double.parse(match.namedGroup('y') ?? '0');
    z = double.parse(match.namedGroup('z') ?? '0');
    s = double.parse(match.namedGroup('s') ?? '0');
  }
}