Matrix4.inverted constructor Null safety

Matrix4.inverted(
  1. Matrix4 other
)

Constructs a matrix that is the inverse of other.

Implementation

factory Matrix4.inverted(Matrix4 other) {
  final r = Matrix4.zero();
  final determinant = r.copyInverse(other);
  if (determinant == 0.0) {
    throw ArgumentError.value(other, 'other', 'Matrix cannot be inverted');
  }
  return r;
}