matrixEquals method Null safety

bool matrixEquals(
  1. Matrix4? a,
  2. Matrix4? b
)

Returns true if the given matrices are exactly equal, and false otherwise. Null values are assumed to be the identity matrix.

Implementation

static bool matrixEquals(Matrix4? a, Matrix4? b) {
  if (identical(a, b)) {
    return true;
  }
  assert(a != null || b != null);
  if (a == null) {
    return isIdentity(b!);
  }
  if (b == null) {
    return isIdentity(a);
  }
  assert(a != null && b != null);
  return a.storage[0] == b.storage[0]
      && a.storage[1] == b.storage[1]
      && a.storage[2] == b.storage[2]
      && a.storage[3] == b.storage[3]
      && a.storage[4] == b.storage[4]
      && a.storage[5] == b.storage[5]
      && a.storage[6] == b.storage[6]
      && a.storage[7] == b.storage[7]
      && a.storage[8] == b.storage[8]
      && a.storage[9] == b.storage[9]
      && a.storage[10] == b.storage[10]
      && a.storage[11] == b.storage[11]
      && a.storage[12] == b.storage[12]
      && a.storage[13] == b.storage[13]
      && a.storage[14] == b.storage[14]
      && a.storage[15] == b.storage[15];
}