formatMessageAsSpans method

List<FluentSpan> formatMessageAsSpans(
  1. String id, {
  2. String? attribute,
  3. Map<String, Object?> args = const {},
  4. List<FluentError>? errors,
})

Format the message identified by id and parse any inline HTML5- shaped markup in the result into a FluentSpan tree.

Behaves like FluentBundle.formatMessage for message resolution (always returns a non-empty list; a missing message yields [FluentTextSpan(id)] and records a FluentReferenceError), then parses the resolved string. Bidi-isolation marks are preserved inside text spans and stripped from attribute values.

Implementation

List<FluentSpan> formatMessageAsSpans(
  String id, {
  String? attribute,
  Map<String, Object?> args = const {},
  List<FluentError>? errors,
}) {
  final resolved = formatMessage(
    id,
    attribute: attribute,
    args: args,
    errors: errors,
  );
  return parseFluentMarkup(resolved);
}