1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 08:15:16 +00:00

Avoid duplicate shortcut creation

This commit is contained in:
2020-04-29 13:49:16 +02:00
parent 25f72bd11c
commit c0e2516f39
2 changed files with 19 additions and 2 deletions

View File

@ -6,6 +6,10 @@ import 'package:comunic/models/custom_emoji.dart';
/// @author Pierre HUBERT
class CustomEmojiesList extends AbstractList<CustomEmoji> {
/// Check if an emoji, identified by its shortcut, is present in this list
bool hasShortcut(String shortcut) =>
firstWhere((f) => f.shortcut == shortcut, orElse: () => null) != null;
/// Serialize this list
List<Map<String, dynamic>> toSerializableList() =>
map((f) => f.toMap()).toList();