toBidiFormatter method
Creates a BidiFormatter object based on the directionality.
If alwaysSpan
is true, a span
tag is always used, ensuring consistent DOM structure.
Implementation
BidiFormatter toBidiFormatter([bool alwaysSpan = false]) =>
switch (this?.value ?? 'UNKNOWN') {
'LTR' => BidiFormatter.LTR(alwaysSpan),
'RTL' => BidiFormatter.RTL(alwaysSpan),
_ => BidiFormatter.UNKNOWN(alwaysSpan),
};