canMerge method

bool canMerge(
  1. AIChatMessageContentBlock other
)

Whether other is a chunk of the same logical streaming block.

Implementation

bool canMerge(final AIChatMessageContentBlock other) {
  if (!isMergeable || !other.isMergeable) return false;
  if (runtimeType != other.runtimeType) return false;
  if (id.isNotEmpty && other.id.isNotEmpty) {
    return id == other.id;
  }
  return index != null && index == other.index;
}