A light-weight Emoji ๐Ÿ“ฆ for Dart & Flutter with all up-to-date emojis written in pure Dart ๐Ÿ˜„ . Made from ๐Ÿ’ฏ% โ˜• with โค๏ธ!

Overview

dart_emoji

๐Ÿ‘‰ A light-weight Emoji ๐Ÿ“ฆ for Dart & Flutter with all up-to-date emojis written in pure Dart ๐Ÿ˜„ . Made from ๐Ÿ’ฏ % โ˜• with โค๏ธ !

This is a fork from flutter-emoji, which is inspired from the node-emoji package.

Why is this a fork from flutter-emoji?

  flutter-emoji dart-emoji
Still maintained? โŒ โœ…
Null Safety โŒ โœ…
Pure Dart Package โŒ โœ…
Updated emojis โŒ โœ…

dart-emoji is even used in production for our app Gatch. You can get Gatch for iOS and Android.

Installation

Add this into pubspec.yaml

dependencies:
  dart_emoji: ^0.1.0

API Usage

First, import the package:

import 'package:dart_emoji/dart_emoji.dart';

There are two main classes you need to know to handle Emoji text: Emoji and EmojiParser.

Basically, you need to initialize an instance of EmojiParser.

var parser = EmojiParser();
var coffee = Emoji('coffee', 'โ˜•');
var heart  = Emoji('heart', 'โค๏ธ');

// Get emoji info
var emojiHeart = parser.info('heart');
print(emojiHeart); '{name: heart, full: :heart:, code: โค๏ธ}'

// Check emoji equality
heart == emojiHeart;  // returns: true
heart == emojiCoffee; // returns: false

// Get emoji by name or code
parser.get('coffee');   // returns: Emoji{name="coffee", full=":coffee:", code="โ˜•"}
parser.get(':coffee:'); // returns: Emoji{name="coffee", full=":coffee:", code="โ˜•"}

parser.hasName('coffee'); // returns: true
parser.getName('coffee'); // returns: Emoji{name="coffee", full=":coffee:", code="โ˜•"}

parser.hasEmoji('โค๏ธ'); // returns: true
parser.getEmoji('โค๏ธ'); // returns: Emoji{name="heart", full=":heart:", code="โค๏ธ"}

parser.emojify('I :heart: :coffee:'); // returns: 'I โค๏ธ โ˜•'
parser.unemojify('I โค๏ธ โ˜•'); // returns: 'I :heart: :coffee:'

// Check if text contains only emojis
EmojiUtil.hasTextOnlyEmoji("๐Ÿ‘‹"); // returns true
EmojiUtil.hasTextOnlyEmoji("๐Ÿ‘‹ Hello"); // returns false

All methods will return Emoji.None if emoji is not found.

parser.get('does_not_exist_emoji_name'); // returns: Emoji.None

License

MIT @ 2021 Gatch GmbH.

Comments
  • Some emoji's can't be unemojified

    Some emoji's can't be unemojified

    Hey! Thank you for taking up this abandoned library ๐Ÿ™‡

    I've noticed that some emoji's can't be unemojified, probably because the emoji consist of multiple elements like the one which are gender specific.

      test('unemojify a text ', () {
        expect(emojiParser.unemojify('๐Ÿšฃโ€โ™‚๏ธ'), ':man-rowing-boat:');
        expect(emojiParser.unemojify('๐Ÿ„โ€โ™‚๏ธ'), ':man-surfing:');
      });
    

    I also needed to replace the rowboat emoji with this one ๐Ÿšฃ to receive a result like this :rowboat:โ€:male_sign:' Seems some of the neutral emoji's are not correct yet.

    bug 
    opened by Fintasys 3
  • Remove comparison with `flutter_emoji` package, because no point of the table is valid anymore.

    Remove comparison with `flutter_emoji` package, because no point of the table is valid anymore.

    The flutter_emoji removed the Flutter SDK dependency (https://github.com/petehouston/flutter-emoji/commit/b2894a5893216bdd832af82074da46bf5e128bda) and added null safety support (https://github.com/petehouston/flutter-emoji/commit/8d6d2f73b1a84a812c4552036b3fb43572ecbcba). Therefore, no point of the table is valid anymore.

    opened by nilsreichardt 0
  • Add `build` folder to `.gitignore`

    Add `build` folder to `.gitignore`

    When generating a coverage report, a build folder is created. This folder should not be tracked in git. Therefore, I added the build folder to the .gitignore file.

    opened by nilsreichardt 0
  • Add parameter `ignoreWhitespace` to `EmojiUtils.hasOnlyEmojis()`

    Add parameter `ignoreWhitespace` to `EmojiUtils.hasOnlyEmojis()`

    EmojiUtils.hasOnlyEmojis('๐Ÿ‘ ๐Ÿ‘', ignoreWhitespace: false); // returns false
    EmojiUtils.hasOnlyEmojis('๐Ÿ‘ ๐Ÿ‘', ignoreWhitespace: true); // returns true
    
    opened by nilsreichardt 0
  • Add +1.750 tests, remove RegExp for `unemojify` method and remove duplicates names

    Add +1.750 tests, remove RegExp for `unemojify` method and remove duplicates names

    Adding +1.750 tests

    dart test
    00:02 +1803: All tests passed!  
    

    I added for every emoji and test, which checks if you can revert this emoji to the name, like ๐Ÿ‡ฉ๐Ÿ‡ช to flag-de. The tests are helpful to be sure that the unemojify method is working for every emoji.

    Remove RegExp for unemojify

    Because of the use of characters package, is there now no need for the RegExp in the unemojify method.

    Removing duplicate names

    There were some emojis which had duplicates keys, like ๐Ÿ‡ฉ๐Ÿ‡ช had de and flag-de. This caused some problems with the unemojify. Therefore, I removed the duplicated keys emojis. The following emojis are effected by the change:

    โ—, ๐Ÿ‡จ๐Ÿ‡ณ, ๐Ÿ‡ฉ๐Ÿ‡ช, ๐Ÿ‡ช๐Ÿ‡ธ, ๐Ÿ‡ซ๐Ÿ‡ท, ๐Ÿ‡ฌ๐Ÿ‡ง, ๐Ÿ‡ฌ๐Ÿ‡ง, ๐Ÿ‡ฎ๐Ÿ‡น, ๐Ÿ‡ฏ๐Ÿ‡ต, ๐Ÿ‡ฐ๐Ÿ‡ท, ๐Ÿ‡ท๐Ÿ‡บ, ๐Ÿ‡บ๐Ÿ‡ธ, ๐ŸŒ”, ๐ŸŒค๏ธ, ๐ŸŒฅ๏ธ, ๐ŸŒฆ๏ธ, ๐ŸŒฉ๏ธ, ๐ŸŒช๏ธ, ๐Ÿณ, ๐Ÿƒโ€โ™‚๏ธ, ๐Ÿƒโ€โ™‚๏ธ, ๐ŸŠโ€โ™‚๏ธ, ๐Ÿ‹๏ธโ€โ™‚๏ธ, ๐ŸŒ๏ธโ€โ™‚๏ธ, ๐Ÿฎ, ๐Ÿ, ๐Ÿž, ๐Ÿฌ, ๐Ÿพ, ๐Ÿ‘Š, ๐Ÿ‘, ๐Ÿ‘Ž, ๐Ÿ‘•, ๐Ÿ‘ž, ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆ, ๐Ÿ‘ซ, ๐Ÿ‘ซ, ๐Ÿ‘ฌ, ๐Ÿ‘ญ, ๐Ÿ‘ฎโ€โ™‚๏ธ, ๐Ÿ‘ฏโ€โ™€๏ธ, ๐Ÿ‘ฏโ€โ™€๏ธ, ๐Ÿ‘ฏโ€โ™‚๏ธ, ๐Ÿ‘ฑโ€โ™‚๏ธ, ๐Ÿ‘ณโ€โ™‚๏ธ, ๐Ÿ‘ทโ€โ™‚๏ธ, ๐Ÿ’โ€โ™€๏ธ, ๐Ÿ’‚โ€โ™‚๏ธ, ๐Ÿ’†โ€โ™€๏ธ, ๐Ÿ’‡โ€โ™€๏ธ, ๐Ÿ’ฅ, ๐Ÿ’ฉ, ๐Ÿ“–, ๐Ÿ“, ๐Ÿ”ช, ๐Ÿ•ต๏ธโ€โ™‚๏ธ, ๐Ÿ–•, ๐Ÿ˜†, ๐Ÿ™…โ€โ™€๏ธ, ๐Ÿ™†โ€โ™€๏ธ, ๐Ÿ™‡โ€โ™‚๏ธ, ๐Ÿ™‹โ€โ™€๏ธ, ๐Ÿ™โ€โ™€๏ธ, ๐Ÿ™Žโ€โ™€๏ธ, ๐Ÿš—, ๐Ÿšดโ€โ™‚๏ธ, ๐Ÿšตโ€โ™‚๏ธ, ๐Ÿšถโ€โ™‚๏ธ, ๐Ÿค˜, ๐Ÿคž, ๐Ÿคจ, ๐Ÿคฉ, ๐Ÿคช, ๐Ÿคซ, ๐Ÿคฌ, ๐Ÿคญ, ๐Ÿคฎ, ๐Ÿคฏ, ๐Ÿคถ, ๐Ÿง–โ€โ™‚๏ธ, ๐Ÿง—โ€โ™€๏ธ, ๐Ÿง˜โ€โ™€๏ธ, ๐Ÿง™โ€โ™€๏ธ, ๐Ÿงšโ€โ™€๏ธ, ๐Ÿง›โ€โ™€๏ธ, ๐Ÿงœโ€โ™‚๏ธ, ๐Ÿงโ€โ™‚๏ธ, ๐Ÿงžโ€โ™‚๏ธ, ๐ŸงŸโ€โ™‚๏ธ, โ˜Ž๏ธ, โš•๏ธ, โ›ต, โ›น๏ธโ€โ™‚๏ธ, โœ‰๏ธ, โœ‹

    opened by nilsreichardt 0
  • Improve emoji RegEx and change `hasTextOnlyEmojis` to `hasOnlyEmojis`

    Improve emoji RegEx and change `hasTextOnlyEmojis` to `hasOnlyEmojis`

    Description

    This PR contains two big changes:

    • Improving the emoji RegEx (thanks for the help by @creativecreatorormaybenot)
    • Changing the name of hasTextOnlyEmojis to hasOnlyEmojis (it's a breaking change!) and improving the implementation of this method

    Thanks to the improvements, the conversion of emojis is now done much more reliably (#22, #21).


    Closes #22 Closes #21

    opened by nilsreichardt 0
  • `EmojiUtil.hasTextOnlyEmojis('๐Ÿ‡ต๐Ÿ‡น')` should return true

    `EmojiUtil.hasTextOnlyEmojis('๐Ÿ‡ต๐Ÿ‡น')` should return true

    Code to reproduce

    import 'package:dart_emoji/dart_emoji.dart';
    import 'package:test/test.dart';
    
    void main() {
      test('๐Ÿ‡ต๐Ÿ‡น', () {
        expect(EmojiUtil.hasTextOnlyEmojis('๐Ÿ‡ต๐Ÿ‡น'), isTrue);
      });
    }
    
    bug 
    opened by nilsreichardt 0
  • Remove installation section from `README.md`

    Remove installation section from `README.md`

    I removed this section from the README.md, because every package has an installation tab provided by pub.dev, and it's easy to forget to update this section.

    opened by nilsreichardt 0
  • Improve emoji mapping

    Improve emoji mapping

    Resolves #17.

    After refactoring this, I feel like this does not quite achieve what I thought because it is still not optimal. However, I would probably rewrite the rest of the code as well, which is not very helpful.

    At least the file gives a better overview like this, which I like :)

    opened by creativecreatorormaybenot 0
  • Issues with `JSON_EMOJI` map

    Issues with `JSON_EMOJI` map

    I have a number of concerns with:

    https://github.com/GatchHQ/dart-emoji/blob/8f5dfffb404d39c9b76c3ca9027e67c423ecaab3/lib/dart_emoji.dart#L121

    1. Could be directly stored as a map โ†’ increased efficiency because there is no need for decoding the JSON data at runtime.
    2. Cannot see how many entries there are โ†’ each entry should be on a separate line.
    3. Difficult to run Git diff on โ†’ each entry should be on a separate line.
    4. Probably no need for a public static member โ†’ could be a private const at the end of the file.
    opened by creativecreatorormaybenot 0
Releases(v0.2.0+2)
  • v0.2.0+2(Feb 4, 2022)

    What's Changed

    • Remove comparison with flutter_emoji package, because no point of the table is valid anymore by @nilsreichardt in https://github.com/GatchHQ/dart-emoji/pull/32
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0+1(Dec 17, 2021)

    What's Changed

    • Fix unnecessary type check in dart_emoji_test.dart by @nilsreichardt in https://github.com/GatchHQ/dart-emoji/pull/30
    • Add pubspec.lock to .gitignore by @nilsreichardt in https://github.com/GatchHQ/dart-emoji/pull/29
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Nov 25, 2021)

    • BREAKING CHANGE: Rename EmojiUtils.hasTextOnlyEmojis() to EmojiUtils.hasOnlyEmojis(). #25
    • BREAKING CHANGE: Remove duplicated keys for some emojis. See https://github.com/GatchHQ/dart-emoji/pull/25 for the effected emojis. #25
    • BREAKING CHANGE: Moving REGEX_EMOJI from EmojiParser to EmojiUtils #25
    • Improved REGEX_EMOJI RegExp #25
    • Supporting more emojis for EmojiUtils.hasOnlyEmojis() #25
    • Add parameter ignoreWhitespace to EmojiUtils.hasOnlyEmojis() #26
    Source code(tar.gz)
    Source code(zip)
  • v0.1.1+2(Nov 22, 2021)

  • v0.1.1+1(Nov 22, 2021)

  • v0.1.1(Nov 22, 2021)

  • v0.1.0(Nov 21, 2021)

Owner
Gatch
Gatch
Ejimo - Comprehensive emoji and symbol picker.

Ejimo Find and copy unicode characters, emoticons, glyphs and symbols with Ejimo. Ejimo is a comprehensive emoji and symbol piker that puts every char

null 20 Dec 19, 2022
A Flutter widget to show a text form field to display a date or clock dialog

A Flutter widget to show a text form field to display a date or clock dialog. This widget extend TextField and has a similar behavior as TextFormField.

m3uzz Soluรงรตes em TI 82 Jan 6, 2023
Flutter widget form select a date in horizontal timeline with customizable styles.

Flutter widget form select a date in horizontal timeline with customizable styles. Getting Started You can use this package when you need to add a dat

Jose Manuel Mรกrquez 158 Dec 2, 2022
Pure Dart and Flutter package for Android,IOS and Web

Fancy Flutter Alert Dialog Pure Dart and Flutter package for Android,IOS and Web A flutter Package to show custom alert Dialog,you can choose between

Dokkar Rachid Reda 119 Sep 23, 2022
A Flutter plugin that makes it easier to make floating/overlay windows for Android with pure Flutter

flutter_floatwing A Flutter plugin that makes it easier to make floating/overlay windows for Android with pure Flutter. Android only Features Pure Flu

Zoe 116 Dec 21, 2022
Math rendering and editing in pure Flutter.

Flutter Math Math equation rendering in pure Dart & Flutter. This project aims to achieve maximum compatibility and fidelity with regard to the KaTeX

null 109 Dec 16, 2022
A pure flutter toast library

oktoast A library for flutter. A pure dart toast Library. You can completely customize the style of toast. ไธญๆ–‡ๅšๅฎขไป‹็ป Screenshot Default Custom GIF Versio

OpenFlutter 438 Dec 24, 2022
An advanced flutter package to build responsive application accross all platform with ease and has an handful of different types of extension

Flutter Next Now build flutter apps with ease and responsive. An advanced flutter package to build responsive application accross all platform with ea

Shashi Kumar 10 Dec 29, 2022
Here you will get basic implementation of all useful and top widgets in flutter.

Top Widgets in Flutter This is a common repo where you can get most frequest used widgets in flutter. Samples Getting Started This project is a starti

Sakhawat Hossain 5 Nov 3, 2022
A provider that passes EventBus down to all the widgets.

A provider that passes EventBus down to all the widgets.

null 0 Jul 9, 2022
A simple particle generator sample written in Flutter

Bubbles A basic particle generator sample written in Flutter. Demo License Copyright 2018 Anup Cowkur Permission is hereby granted, free of charge, t

Anup Cowkur 61 Nov 25, 2022
Smartwatch widget for Windows made with Flutter.

Smart Watch Widget Smartwatch widget for Windows made with Flutter. This open-source project was created as an example of what we can do with Flutter

Yehuda Kremer 18 Oct 12, 2022
A dice game made with Flutter and its Animation Widget

Jogo de dado feito com animaรงรฃo em flutter Esse projeto รฉ um jogo de dado feito com Flutter e seus Widget de animaรงรฃo. Nรฃo foi necessรกrio uso de pacot

Francis Santos 0 May 10, 2022
Custom widgets and utils using Flutter framework widgets and Dart language

reuse_widgets_and_utils The custom widgets and utils using Flutter framework widgets and Dart programming language. Getting Started This project is a

null 1 Oct 29, 2021
Flutter package: Easy and powerful internationalization using Dart extensions.

i18n_extension Non-boilerplate Translation and Internationalization (i18n) for Flutter Start with a widget with some text in it: Text("Hello, how are

Marcelo Glasberg 262 Dec 29, 2022
Unofficial search provider for Medium for dart/flutter apps.

medium_search Unofficial search provider for Medium that can be used in dart or flutter apps. This library provides you an easy way to get search resu

Clone Conflict 1 Jan 10, 2022
Package ANAlysis for Dart

A library for analyzing Dart packages. It invokes executables from the Dart SDK (or from the Flutter SDK if the package uses Flutter). Reports are cre

Dart 151 Dec 30, 2022
Making-form - A form design with dart programming and auto next facility

Making-form - A form design with dart programming and auto next facility

Munem Sarker 3 Nov 15, 2022
A dart package to display a horizontal bar of customisable toggle tabs. Supports iOS and Android.

toggle_bar A dart package to display a horizontal bar of customisable toggle tabs. Supports iOS and Android. Installation Depend on it. dependencies:

Prem Adithya 9 Jul 13, 2022