Move isOnlyEmoji utility function into String extension
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'package:emojis/emoji.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stream_chat/stream_chat.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -215,16 +214,3 @@ StreamSvgIcon getFileTypeImage(String type) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final _emojis = Emoji.all();
|
||||
|
||||
bool textIsOnlyEmoji(String text) {
|
||||
return text.trim().characters.isNotEmpty &&
|
||||
text.trim().characters.every((c) =>
|
||||
_emojis.firstWhere(
|
||||
(Emoji emoji) => emoji.char.contains(c),
|
||||
orElse: () => null,
|
||||
) !=
|
||||
null) &&
|
||||
text.characters.length < 4;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user