format method
Formats segment of this document with specified attribute
.
Applies heuristic rules before modifying this document and produces a change event with its source set to ChangeSource.local.
Returns an instance of Delta actually composed into this document. The returned Delta may be empty in which case this document remains unchanged and no change event is published to the changes stream.
Implementation
Delta format(int index, int len, Attribute? attribute) {
assert(index >= 0 && len >= 0 && attribute != null);
var delta = Delta();
final formatDelta = _rules.apply(RuleType.format, this, index, len: len, attribute: attribute);
if (formatDelta.isNotEmpty) {
compose(formatDelta, ChangeSource.local);
delta = delta.compose(formatDelta);
}
return delta;
}