bluesky_text 1.5.4 copy "bluesky_text: ^1.5.4" to clipboard
bluesky_text: ^1.5.4 copied to clipboard

Provides the easiest and most powerful way to analyze the text for Bluesky Social.

bluesky_text

The Easiest & Most Powerful Way to Analyze the Text for Bluesky Social 🦋

1. Guide 🌎 #

Provides the easiest and most powerful way to analyze the text on Bluesky Social in Dart and Flutter apps.

Have you ever had trouble parsing mentions or links in the text you post when using Bluesky Social's API? If so, this is the library you are looking for!

1.1. Features ⭐ #

  • Zero Dependency
  • Automatic Detection of Handle, Link, Tag in text
  • ✅ Supports Automatic Conversion to Facet
  • 100% Compatible with bluesky
  • ✅ Supports Unicode Grapheme Clusters
  • ✅ Supports Safe Text Splitting
  • Works in All Languages
  • ✅ Supports Markdown Style Links
  • Well Documented and Well Tested
  • 100% Null Safety

1.2. Getting Started 💪 #

Pass any text to BlueskyText, read the detected entities, and convert it into the text + facets you post with the Bluesky API — all zero-dependency.

import 'package:bluesky_text/bluesky_text.dart';

Future<void> main() async {
  final text = BlueskyText(
    'I speak 日本語 and English 🚀 @shinyakato.dev and @shinyakato.bsky.social. '
    'Visit 🚀 https://shinyakato.dev.',
  );

  // Extract entities. Each carries its value and byte indices.
  print(text.handles); // @shinyakato.dev, @shinyakato.bsky.social
  print(text.links); // https://shinyakato.dev
  print(text.entities); // handles, links and tags in document order

  // Build everything needed to create a post in one call: the formatted text,
  // its facets, and any handles that failed to resolve to a DID.
  final data = await text.toPostData();

  if (data.unresolvedHandles.isNotEmpty) {
    print('Could not resolve: ${data.unresolvedHandles}');
  }

  print(data.text); // formatted, posting-ready text
  print(data.facets); // facets ready for `app.bsky.feed.post`
}

toPostData({String? service, HandleResolver? resolver}) resolves mention DIDs against bsky.social by default; pass a service to target another PDS, or a resolver to serve DIDs from your own cache instead of a per-handle network call. The returned facets map straight onto RichtextFacet.fromJson when posting with bluesky.

See example or official documents from following links.

1.3. Tips 🏄 #

12
likes
160
points
3.9k
downloads

Documentation

API reference

Publisher

verified publisheratprotodart.com

Weekly Downloads

Provides the easiest and most powerful way to analyze the text for Bluesky Social.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#atproto #bluesky #util

Funding

Consider supporting this project:

github.com

License

BSD-3-Clause (license)

Dependencies

characters, freezed_annotation, json_annotation, xrpc

More

Packages that depend on bluesky_text