πŸ‘‰ A light-weight Emoji πŸ“¦ for Flutter and Dart-based applications with all up-to-date emojis πŸ˜„. Made from πŸ’―% β˜• with ❀️!

Overview

flutter_emoji

Build Status Coverage

Null Safety

πŸ‘‰ A light-weight Emoji πŸ“¦ for Flutter and Dart-based applications with all up-to-date emojis πŸ˜„ . Made from πŸ’― % β˜• with ❀️ !

Inspired from the node-emoji package.

Update: since v2.3.4+, support all emojis listed in Unicode 13.0.

NOTE: I initially created this package to support my Flutter apps. However, Dart is growing to support on more platforms, so starting from v2.4.0+, this package will be available to all types of Dart-based applications.

Installation

Add this into pubspec.yaml

dependencies:
  flutter_emoji: ">= 2.0.0"

API Usage

First, import the package:

import 'package:flutter_emoji/flutter_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 and call its methods.

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:'

// Count number of present emojis
parser.count('I ❀️ Flutter just like β˜•'); // returns: 2

// Count frequency of a specific emoji
parser.frequency('I ❀️ Flutter just like β˜•', '❀️'); // returns: 1

// Replace a specific emoji by another emoji
parser.replace('I ❀️ coffee', '❀️', '❀️‍πŸ”₯'); // returns: 'I ❀️‍πŸ”₯ coffee'

// Get a list of all emojis from the input
parser.parseEmojis('I ❀️ Flutter just like β˜•'); // returns: ['❀️', 'β˜•']

All methods will return Emoji.None if emoji is not found, except these two emojify() and unemojify() that will return original input.

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

Initialize emoji data for EmojiParser

There are two available datasets available you can choose to initialize for EmojiParser: local and server.

// to load local dataset
var localParser1 = EmojiParser();
var localParser2 = EmojiParser(init: false);
localParser2.initLocalData();

// to load server dataset
// this will trigger an URL request to download latest emoji data
var serverParser = EmojiParser(init: false);
await serverParser.initServerData(); // make sure to wrap in an `async` function/method.

NOTE: make sure to add Internet permission on Android.

<!-- Required to fetch data from the internet. -->
<uses-permission android:name="android.permission.INTERNET" />

In any occasion that local dataset doesn't have the latest emojis, load server dataset instead. If it is still not working, please create an issue or pull request to the repo.

TODO

Features coming to this package:

  • Get detail of an emoji.
  • Refactor for easier usage.
  • Validate bad input.
  • Find list of available emojis from a given text.
  • Replace emoji by another one.
  • Callback for additional formatting found emojis.
  • Ability to fetch latest emoji list.
  • Make extensible emoji matcher.

License

MIT @ 2019 Pete Houston.

Comments
  • App crashes when I install the package

    App crashes when I install the package

    The flutter app crashes after I install flutter-emoji and import it above the current displayed view, each time I run hot-reload the app. It does the same when I use Emoji picker package. Is a problem with my flutter version?

    `flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, v1.12.13+hotfix.7, on Microsoft Windows [version 10.0.18362.592], locale en-EN)

    [√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [√] Android Studio (version 3.5) [√] IntelliJ IDEA Community Edition (version 2019.2) [√] IntelliJ IDEA Ultimate Edition (version 2019.2) [√] VS Code (version 1.39.2) [√] Connected device (1 available)

    β€’ No issues found!`

    opened by GENL 6
  • Emojifying a country

    Emojifying a country

    I followed your example and it works but when I use it to emojify a country it just shows the full text instead of the emoji.

    ex:

    EmojiParser().emojify('I :heart: :coffee:') // -> I ❀️ β˜•
    EmojiParser().emojify('I :flag-ca: :coffee:')  // -> I :flag-ca: β˜•
    

    and when I print the getEmoji/Name and hasEmoji/Name functions on it both the emoji and the name respectively I get the following:

    I/flutter ( 7213): Emoji{name="flag-ca", full=":flag-ca:", code="πŸ‡¨πŸ‡¦"}
    I/flutter ( 7213): Emoji{name="flag-ca", full=":flag-ca:", code="πŸ‡¨πŸ‡¦"}
    true
    true
    

    When I use the emoji directly it works. What am I doing wrong?

    opened by zxcvbnmmohd 4
  • Wrong REGEX_NAME value

    Wrong REGEX_NAME value

    Currently the name regex is defined as follows

    :([\w-]+):
    

    Unluckily, this doesn't work with one of the most used emojis: :+1:
    It's value is :+1: and the + is not contained inside the regex, which fails to pass and thus provide the valid emoji.

    To solve this, the regex should be changed in

    :([\w-+]+):
    

    Adding the + would solve the problem.

    opened by RiccardoM 3
  • JSON_EMOJI not complete

    JSON_EMOJI not complete

    Hi,

    When I tried to use hasEmoji with πŸ₯°, it returns false because it can't be found in _emojisByCode. I search in JSON_EMOJI and "smiling face with hearts" is not in the string.

    Is there any way to add missing emojis?

    opened by vsantele 1
  • Substitute dash with underscore in JSON_EMOJI string

    Substitute dash with underscore in JSON_EMOJI string

    Hi, thanks for your work. I noticed that emoji with a tone (like "skin-tone-2" for example) can't be parsed because dashed don't get matched in your emojify method. I solved by replacing every dash with an underscore in the JSON_EMOJI string field. Hope that helps!

    opened by melvinm99 1
  • How can you list all available emojis?

    How can you list all available emojis?

    I'm trying to build an emoji picker but seems like this package does not have a way in which you can retrieve all emojis or emojis based on categories like other packages. Is there a way to retrieve all emojis and also emojis based on category like you have in most apps that use emoji?

    opened by dancb10 1
  • How to use it description is not clear that's why it is not most popular and users are not able to use them in their project

    How to use it description is not clear that's why it is not most popular and users are not able to use them in their project

    How to use it description is not clear that's why it is not most popular and users are not able to use them in their project.

    This is humble request to @petehouston Please update the package description and re-write it so that a new developer/user can use it easily. This is just friendly suggestion which will help you to make this package one of the most popular packages. Update example tab also on pub.dev. Example should be just like clone your repository and user can understand package feature in 10 seconds. Thanks a lot.

    opened by kamleshwebtech 0
  • Regex does not work because it will include some Chinese characters such as

    Regex does not work because it will include some Chinese characters such as "。" (the "." in Chinese which is very common)

    Hi thanks for the lib! However, Regex does not work because it will include some Chinese characters such as "。" (the "." in Chinese which is very common.)

    opened by fzyzcjy 0
  • Emoji Regex

    Emoji Regex

    I was wondering if you could help me with blocking emojis from being typed into input boxes.

    The emoji 🌬️ (and a few others) still get typed into input boxes that have been blacklisted with your regex.

       return BlacklistingTextInputFormatter(
            EmojiParser.REGEX_EMOJI
        );
    

    They dont get typed but they get counted as input. E.g. if you have a hint in the text box (or character count) and type the emoji the hint will disappear and the character count will increase to 1. There is actually no input in the box, just empty space.

    bug 
    opened by febg11 7
Owner
Pete Houston
just a software engineer working with Go, Dart, PHP, JS, Java, Docker, K8s and Cloud.
Pete Houston
A composable, light-weight package that can be used as a placeholder whenever you need some fake data

API Placeholder A composable, light-weight package that can be used as a placeholder whenever you need some fake data. With this package, you can get

ASMIT VIMAL 2 Feb 27, 2022
A flutter date time picker inspired by flutter-cupertino-date-picker

Flutter Datetime Picker (Pub) flutter_datetime_picker A flutter date time picker inspired by flutter-cupertino-date-picker you can choose date / time

null 0 Nov 30, 2021
Nepali date picker - Material Style Date Picker with Bikram Sambat(Nepali) Calendar Support

Nepali Date Picker + Calendar Material and Cupertino Styled Date Picker, Date Range Picker and Calendar with Bikram Sambat(Nepali) Support. Nepali Dat

Sarbagya Dhaubanjar 35 Jan 3, 2023
Flutter Slider 🎚 + Emojis 🌻 = πŸ’™

Slidermoji Flutter Slider ??️ + Emojis ?? = ?? About Example showcasing the use of Emojis in Slider Widget. Dependencies demoji Contributing Feel free

null 17 Mar 12, 2021
Image editing using Paints, Text, Filters, Emoji and Sticker like stories, Built With Flutter

ImageEditorPro Image Editor Plugin with simple, easy support for image editing u

Kaushikkumar Godhani 4 Nov 13, 2022
Flutter package to get keyboard height. Can be used to display a sticker/emoji modal with correct height.

flutter_persistent_keyboard_height Flutter package to get keyboard height. The height is persisted during app sessions and keyboard states (you can us

Arshak Aghakaryan 13 Oct 17, 2022
A Flutter package that provides an Emoji Keyboard widget.

Flutter Choose Keyboard A Flutter package that provides an Emoji Keyboard widget. BASED IN: https://github.com/JeffG05/emoji_picker Key Features Flutt

null 1 Oct 22, 2021
App to control your health activities like calorie, water, medicine consumption, sleeping and weight control.

Handy Configuration for yourself This project contains google-services.json file of my own. You can connect your own firebase project using the follow

KanZa Studio 104 Jan 3, 2023
This perfect starter kit is an app based on React Native and UI Kitten library with Light and Dark themes support.

Kitten Tricks This perfect starter kit is an app based on React Native and UI Kitten library with Light and Dark themes support. It’s completely free

Akveo 7k Dec 30, 2022
Weight tracker - OurPass interview challenge

Weight tracker - OurPass Screenshots Tools Used flutter: Google's UI toolkit for building cross platform apps firebase: Google's BAAS provider: State

Stanley Akpama 3 May 31, 2022
Dart library for parsing relative date and time.

Dateparser Dart library for parsing relative date and time. Examples just now a moment ago tomorrow today yesterday 10 days remaining 2 hours ago 2 mo

Mensch272 5 Sep 20, 2022
Find The Latest trending and upcoming movies and tv shows with MovieDB app. The app contains all info about movies and tv shows. find similar movies or shows, Browse all genres, video trailers, backdrops, logos, and posters.

MovieDB App Features. Dynamic Theming Search Functionality Onboarding-Screen Select favourite movie Home Screen Tranding movie Movies different catego

Ansh rathod 80 Dec 12, 2022
Tasawq App β€” Flutter framework and Firebase An application that objectives to display all nearby stores of all kinds and real estate.

Tasawq App β€” Flutter framework and Firebase An application that objectives to display all nearby stores of all kinds and real estate. Multi-vendor, standard user login to view nearby products and stores for rating, follow-up, messaging and more

null 1 Nov 10, 2022
Lite-graphql - A light way implementation of GraphQL client in dart language

lite GraphQL client A light way implementation of GraphQL client in dart languag

Vincenzo Palazzo 3 Mar 17, 2022
Flying Fish is full-stack Dart framework - a semi-opinionated framework for building applications exclusively using Dart and Flutter

Flying Fish is full-stack Dart framework - a semi-opinionated framework for building applications exclusively using Dart and Flutter.

Flutter Fish 3 Dec 27, 2022
Z time ago - A simple Flutter z time ago package used to change date to time ago for english, arabic and kurdish languages

This package is used to get time duration from now and given time for kurdish, a

Zakarya Muhammad 2 May 19, 2022
Flutter cupertino style date picker.

Flutter Cupertino Date Picker [pub packages] | δΈ­ζ–‡θ―΄ζ˜Ž Flutter cupertino date picker. Usage 1. Depend Add this to you package's pubspec.yaml file: depend

Dylan Wu 333 Dec 26, 2022
Flutter cupertino style date picker.

Flutter Cupertino Date Picker [pub packages] | δΈ­ζ–‡θ―΄ζ˜Ž Flutter cupertino date picker. Usage 1. Depend Add this to you package's pubspec.yaml file: depend

Dylan Wu 333 Dec 26, 2022