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

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

example/example.dart

// Copyright 2023 Shinya Kato. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided the conditions.

// ignore_for_file: lines_longer_than_80_chars

import 'package:bluesky_text/bluesky_text.dart';

void main() {
  //! You just need to pass text to parse.
  final text = BlueskyText(
    'I speak 日本語 and English 🚀 @shinyakato.dev and @shinyakato.bsky.social. '
    'Visit 🚀 https://shinyakato.dev.',
  );

  //! The character limit for Bluesky Social posts is 300 characters.
  //! You need to split it before call some properties.
  if (text.isLengthLimitExceeded) {
    //! Let's split.
    final texts = text.split();

    for (final text in texts) {
      print(text.handles);
      print(text.links);
      print(text.entities);
    }
  } else {
    //! If it is less than 300 characters, it can simply be parsed.

    // [{type: handle, value: @shinyakato.dev, indices: {start: 35, end: 50}},
    // {type: handle, value: @shinyakato.bsky.social, indices: {start: 55, end: 78}}]
    print(text.handles);

    // [{type: link, value: https://shinyakato.dev, indices: {start: 91, end: 113}}]
    print(text.links);

    // [{type: handle, value: @shinyakato.dev, indices: {start: 35, end: 50}},
    // {type: handle, value: @shinyakato.bsky.social, indices: {start: 55, end: 78}},
    // {type: link, value: https://shinyakato.dev, indices: {start: 91, end: 113}}]
    print(text.entities);
  }
}
10
likes
0
pub points
83%
popularity

Publisher

verified publisheratprotodart.com

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

Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

github.com

License

unknown (license)

Dependencies

characters, freezed_annotation, json_annotation

More

Packages that depend on bluesky_text