1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 06:19:22 +00:00
comunicmobile/lib/models/displayed_content.dart

39 lines
664 B
Dart
Raw Normal View History

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