Skip to content
pubscout

attributed_text

0.4.7, released 6 months ago by superlist.com

Text with metadata spans for easy text editing and styling.

WASM-ready
$ flutter pub add attributed_text
Source repository

What it does

Combines a standard string with arbitrary metadata spans, allowing developers to attach formatting like bold, italics, or custom links to specific character ranges. It forms the basis of all text representation within super_editor.

AI-written summary of version 0.4.7, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are building a rich text editor or custom text rendering engine.
  • You need to manage overlapping or styled text spans programmatically.

Skip it when

  • You only need basic styled text using Flutter's built-in Text and TextSpan widgets.

Strengths

  • Forms a robust foundation for rich text editing and super_editor.
  • Supports both named attributions and custom metadata classes.

Weaknesses

  • Low-level text representation utility rather than an out-of-the-box rich text UI widget.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
5

not documented

final helloWorld = AttributedText(
  text: "Hello, world!",
  spans: AttributedSpans(
    attributions: [
      const SpanMarker(attribution: bold, offset: 7, markerType: SpanMarkerType.start),
      const SpanMarker(attribution: bold, offset: 12, markerType: SpanMarkerType.end),
    ],
  ),
);

Alternatives

Packages that do the same job and could replace attributed_text.

  • validators2

    String validation and sanitization for Dart.

  • clipboard

    Clipboard manager with text, HTML, and image support across Android, iOS, Web, and Windows.

  • parchment

    Platform-agnostic rich text document model based on Delta format.

  • tint

    Terminal string styling as an extension on String.

Works with

Packages commonly used together with attributed_text: ones it builds on, ones built on it, and its own family.