1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-28 13:58:51 +00:00
comunicmobile/lib/models/displayed_content.dart

39 lines
669 B
Dart
Raw Normal View History

2020-04-16 12:07:21 +00:00
import 'package:flutter_emoji/flutter_emoji.dart';
/// Optimized colons Emoji-parsed string
///
/// @author Pierre Hubert
class DisplayedString {
String _string;
String _parseCache;
DisplayedString(this._string);
int get length => _string.length;
bool get isEmpty => _string.isEmpty;
bool get isNull => _string == null;
String get content => _string;
set content(String content) {
_string = content;
_parseCache = null;
}
@override
String toString() {
return _string;
}
String get parsedString {
if (_parseCache == null) {
_parseCache = EmojiParser().emojify(this._string);
}
return _parseCache;
}
}