text
1.0.0, released 10 months ago by an unverified publisher
Get detailed text metrics like lines, character positions, and locations.
What it does
Allows you to get detailed information about text, such as the number of lines, lines at positions, characters at locations, and mapping between positions and locations. It uses sparse lists for high performance.
AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to map character positions to line and column locations.
- You need fast text analysis and indexing utilities.
Skip it when
- You are looking for complex text parsing or regex matching libraries.
- You only need standard Dart String manipulation methods.
Strengths
- Fast performance using sparse lists.
- Bidirectional mapping between positions, locations, and lines.
Weaknesses
- Very narrow scope focused only on text metrics and indexing.
- Not documented for complex text manipulation or editing.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:text/text.dart';
void main() {
final text = Text('Hello\nWorld');
var position = 0;
var location = text.locationAt(position);
print('pos: $position => loc: ${location.line}:${location.column}');
}Alternatives
Packages that do the same job and could replace text.
- decimal
Arbitrary-precision decimal arithmetic for Dart
76Compare - rational
Allows you to deal with rational numbers in Dart.
50Compare - package_signature
Retrieve Android package signature (SHA1/SHA256) in a Flutter app.
66Compare - flutter_charset_detector
Detect and decode the character encoding of text bytes automatically.
69Compare
Works with
Packages commonly used together with text: ones it builds on, ones built on it, and its own family.