hasSameStyleWith method Null safety

bool hasSameStyleWith(
  1. TextStyleBuilder? other
)

Returns true if this shares same styling with other.

Implementation

bool hasSameStyleWith(TextStyleBuilder? other) {
  if (other == null) {
    return false;
  }
  TextStyleBuilder thisWithBuilder = this;
  while (thisWithBuilder._builders == null) {
    final thisParent = thisWithBuilder.parent;
    if (thisParent == null) {
      break;
    } else {
      thisWithBuilder = thisParent;
    }
  }

  var otherWithBuilder = other;
  while (otherWithBuilder._builders == null) {
    final otherParent = otherWithBuilder.parent;
    if (otherParent == null) {
      break;
    } else {
      otherWithBuilder = otherParent;
    }
  }

  return thisWithBuilder == otherWithBuilder;
}