attributed_text
0.4.7, released 6 months ago by superlist.com
Text with metadata spans for easy text editing and styling.
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.
83Compare - clipboard
Clipboard manager with text, HTML, and image support across Android, iOS, Web, and Windows.
63Compare - parchment
Platform-agnostic rich text document model based on Delta format.
69Compare - tint
Terminal string styling as an extension on String.
50Compare
Works with
Packages commonly used together with attributed_text: ones it builds on, ones built on it, and its own family.
- testattributed_text depends on itA full featured library for writing and running Dart tests across platforms.
- loggingattributed_text depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- charactersattributed_text depends on itUnicode and grapheme cluster aware string manipulation operations for Dart.
- super_text_layoutBuilt on attributed_textConfigurable and extensible text display for custom decorations in Flutter.