easy_emoji 1.0.3 copy "easy_emoji: ^1.0.3" to clipboard
easy_emoji: ^1.0.3 copied to clipboard

Fast and simple way to handle text with emoji. Support unicode emoji 15.0. Uses the Trie and is written in pure Dart

πŸš€Fast and ✨simple way to handle text with πŸ‘emoji.

Support unicode emoji 15.0

Getting started #

Add this into pubspec.yaml

dependencies:
  easy_emoji: ^1.0.2

Usage #

Easy to use:

import 'package:easy_emoji/easy_emoji.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // wait for emoji data loaded, must call WidgetsFlutterBinding.ensureInitialized() before init.
  await emoji.waitInit();
  print(emoji.remove("HiπŸ˜€ emoji")); // Hi emoji
  print("HiπŸ˜€ emoji".removeWithEmoji()); // Hi emoji
  runApp(MyApp());
}

Example #

Use function:

void example() {
  var str = "HiπŸ˜€ emoji";
  final s1 = emoji.replace(
      str, emojiReplacer: (emoji) => "($emoji)", textReplacer: (text) => "{$text}");
  print(s1); // {Hi}(πŸ˜€){ emoji}
  final s2 = emoji.remove(str, removeEmoji: true);
  print(s2); // Hi emoji
  final strList = emoji.split(str, withEmoji: true);
  print(strList); // ["Hi", "πŸ˜€", " emoji"]
  final count = emoji.countEmoji(str);
  print(count); // 1
  
  emoji.handleAll(
    str, 
    emojiHandler: (emoji) {
      // do something with emoji
      print(emoji);
    }, textHandler: (text) {
      // do something with text
      print(text);
    },
  );
  // Hi
  // πŸ˜€
  //  emoji
}

Use extension:

void example() {
  var str = "HiπŸ˜€ emoji";
  final s1 = str.replaceWithEmoji(
      emojiReplacer: (emoji) => "($emoji)", textReplacer: (text) => "{$text}");
  print(s1); // {Hi}(πŸ˜€){ emoji}
  final s2 = str.replaceWithEmoji(emojiReplacer: (emoji) => "#");
  print(s2); // Hi# emoji
  final s3 = str.replaceWithEmoji(textReplacer: (text) => "#");
  print(s3); // #πŸ˜€#
  final s4 = str.removeWithEmoji();
  print(s4); // Hi emoji
  final s5 = str.removeWithEmoji(removeEmoji: false);
  print(s5); // πŸ˜€
  final strList = str.splitWithEmoji();
  print(strList); // ["Hi", "πŸ˜€", " emoji"]
  final count = str.countEmoji();
  print(count); // 1
}

License #

MIT License

4
likes
130
pub points
51%
popularity

Publisher

verified publisherskywalkerdarren.com

Fast and simple way to handle text with emoji. Support unicode emoji 15.0. Uses the Trie and is written in pure Dart

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on easy_emoji