feat: instant tag suggestions, persistent disk cache, history limit settings, match highlighting and category badges (v2.0.9)
This commit is contained in:
@@ -22,6 +22,30 @@ class TagSuggestion {
|
||||
final String providerId;
|
||||
|
||||
String get categoryLabel => category.name;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'name': name,
|
||||
'category': category.name,
|
||||
'postCount': postCount,
|
||||
'providerId': providerId,
|
||||
};
|
||||
|
||||
factory TagSuggestion.fromJson(Map<String, dynamic> json) => TagSuggestion(
|
||||
name: (json['name'] ?? '').toString(),
|
||||
category: tagCategoryFromString((json['category'] ?? '').toString()),
|
||||
postCount: (json['postCount'] as num?)?.toInt() ?? 0,
|
||||
providerId: (json['providerId'] ?? '').toString(),
|
||||
);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is TagSuggestion &&
|
||||
runtimeType == other.runtimeType &&
|
||||
name.toLowerCase() == other.name.toLowerCase();
|
||||
|
||||
@override
|
||||
int get hashCode => name.toLowerCase().hashCode;
|
||||
}
|
||||
|
||||
TagCategory tagCategoryFromString(String? value) {
|
||||
|
||||
Reference in New Issue
Block a user