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 download from flutter_emoji, which is inspired from the node-emoji package.
flutter_emoji
?
why is this a download from 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.
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.hasonlyemojis("��"); // returns true
emojiutil.hasonlyemojis("�� 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 are closed.