diff --git a/lib/src/models/emoji.dart b/lib/src/models/emoji.dart index 75faf08..250c8af 100644 --- a/lib/src/models/emoji.dart +++ b/lib/src/models/emoji.dart @@ -16,6 +16,10 @@ class Emoji({ required final IList aliases, required final String description, required final IList tags, + + /// Anything else the app needs about a custom emoji, e.g. the image it came + /// from, passed back as is to `onSelection`. + @JsonKey(includeFromJson: false) final Object? data, }) with _$Emoji { static Widget widgetFromJson(String emoji) => Text(emoji); diff --git a/lib/src/models/emoji.freezed.dart b/lib/src/models/emoji.freezed.dart index b662ac5..1c19193 100644 --- a/lib/src/models/emoji.freezed.dart +++ b/lib/src/models/emoji.freezed.dart @@ -27,20 +27,20 @@ $EmojiCopyWith get copyWith => _$EmojiCopyWithImpl(this as Emoji, @override bool operator ==(Object other) { final _this = this as Emoji; - return identical(this, other) || (other.runtimeType == runtimeType&&other is Emoji&&(identical(other.widget, _this.widget) || other.widget == _this.widget)&&(identical(other.value, _this.value) || other.value == _this.value)&&const DeepCollectionEquality().equals(other.aliases, _this.aliases)&&(identical(other.description, _this.description) || other.description == _this.description)&&const DeepCollectionEquality().equals(other.tags, _this.tags)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is Emoji&&(identical(other.widget, _this.widget) || other.widget == _this.widget)&&(identical(other.value, _this.value) || other.value == _this.value)&&const DeepCollectionEquality().equals(other.aliases, _this.aliases)&&(identical(other.description, _this.description) || other.description == _this.description)&&const DeepCollectionEquality().equals(other.tags, _this.tags)&&const DeepCollectionEquality().equals(other.data, _this.data)); } @override int get hashCode { final _this = this as Emoji; - return Object.hash(runtimeType,_this.widget,_this.value,const DeepCollectionEquality().hash(_this.aliases),_this.description,const DeepCollectionEquality().hash(_this.tags)); + return Object.hash(runtimeType,_this.widget,_this.value,const DeepCollectionEquality().hash(_this.aliases),_this.description,const DeepCollectionEquality().hash(_this.tags),const DeepCollectionEquality().hash(_this.data)); } @override String toString() { final _this = this as Emoji; - return 'Emoji(widget: ${_this.widget}, value: ${_this.value}, aliases: ${_this.aliases}, description: ${_this.description}, tags: ${_this.tags})'; + return 'Emoji(widget: ${_this.widget}, value: ${_this.value}, aliases: ${_this.aliases}, description: ${_this.description}, tags: ${_this.tags}, data: ${_this.data})'; } @@ -51,7 +51,7 @@ abstract mixin class $EmojiCopyWith<$Res> { factory $EmojiCopyWith(Emoji value, $Res Function(Emoji) _then) = _$EmojiCopyWithImpl; @useResult $Res call({ -@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) Widget widget,@JsonKey(name: "emoji") String value, IList aliases, String description, IList tags +@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) Widget widget,@JsonKey(name: "emoji") String value, IList aliases, String description, IList tags,@JsonKey(includeFromJson: false) Object? data }); @@ -68,14 +68,14 @@ class _$EmojiCopyWithImpl<$Res> /// Create a copy of Emoji /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? widget = null,Object? value = null,Object? aliases = null,Object? description = null,Object? tags = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? widget = null,Object? value = null,Object? aliases = null,Object? description = null,Object? tags = null,Object? data = freezed,}) { return _then(Emoji( widget: null == widget ? _self.widget : widget // ignore: cast_nullable_to_non_nullable as Widget,value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable as String,aliases: null == aliases ? _self.aliases : aliases // ignore: cast_nullable_to_non_nullable as IList,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String,tags: null == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable -as IList, +as IList,data: freezed == data ? _self.data : data , )); } @@ -160,10 +160,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function(@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) Widget widget, @JsonKey(name: "emoji") String value, IList aliases, String description, IList tags)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function(@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) Widget widget, @JsonKey(name: "emoji") String value, IList aliases, String description, IList tags, @JsonKey(includeFromJson: false) Object? data)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _Emoji() when $default != null: -return $default(_that.widget,_that.value,_that.aliases,_that.description,_that.tags);case _: +return $default(_that.widget,_that.value,_that.aliases,_that.description,_that.tags,_that.data);case _: return orElse(); } @@ -181,10 +181,10 @@ return $default(_that.widget,_that.value,_that.aliases,_that.description,_that.t /// } /// ``` -@optionalTypeArgs TResult when(TResult Function(@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) Widget widget, @JsonKey(name: "emoji") String value, IList aliases, String description, IList tags) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function(@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) Widget widget, @JsonKey(name: "emoji") String value, IList aliases, String description, IList tags, @JsonKey(includeFromJson: false) Object? data) $default,) {final _that = this; switch (_that) { case _Emoji(): -return $default(_that.widget,_that.value,_that.aliases,_that.description,_that.tags);case _: +return $default(_that.widget,_that.value,_that.aliases,_that.description,_that.tags,_that.data);case _: throw StateError('Unexpected subclass'); } @@ -201,10 +201,10 @@ return $default(_that.widget,_that.value,_that.aliases,_that.description,_that.t /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function(@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) Widget widget, @JsonKey(name: "emoji") String value, IList aliases, String description, IList tags)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function(@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) Widget widget, @JsonKey(name: "emoji") String value, IList aliases, String description, IList tags, @JsonKey(includeFromJson: false) Object? data)? $default,) {final _that = this; switch (_that) { case _Emoji() when $default != null: -return $default(_that.widget,_that.value,_that.aliases,_that.description,_that.tags);case _: +return $default(_that.widget,_that.value,_that.aliases,_that.description,_that.tags,_that.data);case _: return null; } @@ -216,7 +216,7 @@ return $default(_that.widget,_that.value,_that.aliases,_that.description,_that.t class _Emoji extends Emoji { - _Emoji({@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) required this.widget, @JsonKey(name: "emoji") required this.value, required this.aliases, required this.description, required this.tags}): super(widget: widget, value: value, aliases: aliases, description: description, tags: tags); + _Emoji({@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) required this.widget, @JsonKey(name: "emoji") required this.value, required this.aliases, required this.description, required this.tags, @JsonKey(includeFromJson: false) this.data}): super(widget: widget, value: value, aliases: aliases, description: description, tags: tags, data: data); @override@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) final Widget widget; @@ -224,6 +224,9 @@ class _Emoji extends Emoji { @override final IList aliases; @override final String description; @override final IList tags; +/// Anything else the app needs about a custom emoji, e.g. the image it came +/// from, passed back as is to `onSelection`. +@override@JsonKey(includeFromJson: false) final Object? data; /// Create a copy of Emoji /// with the given fields replaced by the non-null parameter values. @@ -235,18 +238,18 @@ _$EmojiCopyWith<_Emoji> get copyWith => __$EmojiCopyWithImpl<_Emoji>(this, _$ide @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _Emoji&&(identical(other.widget, widget) || other.widget == widget)&&(identical(other.value, value) || other.value == value)&&const DeepCollectionEquality().equals(other.aliases, aliases)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other.tags, tags)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Emoji&&(identical(other.widget, widget) || other.widget == widget)&&(identical(other.value, value) || other.value == value)&&const DeepCollectionEquality().equals(other.aliases, aliases)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other.tags, tags)&&const DeepCollectionEquality().equals(other.data, data)); } @override int get hashCode { - return Object.hash(runtimeType,widget,value,const DeepCollectionEquality().hash(aliases),description,const DeepCollectionEquality().hash(tags)); + return Object.hash(runtimeType,widget,value,const DeepCollectionEquality().hash(aliases),description,const DeepCollectionEquality().hash(tags),const DeepCollectionEquality().hash(data)); } @override String toString() { - return 'Emoji(widget: $widget, value: $value, aliases: $aliases, description: $description, tags: $tags)'; + return 'Emoji(widget: $widget, value: $value, aliases: $aliases, description: $description, tags: $tags, data: $data)'; } @@ -257,7 +260,7 @@ abstract mixin class _$EmojiCopyWith<$Res> implements $EmojiCopyWith<$Res> { factory _$EmojiCopyWith(_Emoji value, $Res Function(_Emoji) _then) = __$EmojiCopyWithImpl; @override @useResult $Res call({ -@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) Widget widget,@JsonKey(name: "emoji") String value, IList aliases, String description, IList tags +@JsonKey(fromJson: Emoji.widgetFromJson, readValue: Emoji.readWidgetValueFromJson) Widget widget,@JsonKey(name: "emoji") String value, IList aliases, String description, IList tags,@JsonKey(includeFromJson: false) Object? data }); @@ -274,14 +277,14 @@ class __$EmojiCopyWithImpl<$Res> /// Create a copy of Emoji /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? widget = null,Object? value = null,Object? aliases = null,Object? description = null,Object? tags = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? widget = null,Object? value = null,Object? aliases = null,Object? description = null,Object? tags = null,Object? data = freezed,}) { return _then(_Emoji( widget: null == widget ? _self.widget : widget // ignore: cast_nullable_to_non_nullable as Widget,value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable as String,aliases: null == aliases ? _self.aliases : aliases // ignore: cast_nullable_to_non_nullable as IList,description: null == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String,tags: null == tags ? _self.tags : tags // ignore: cast_nullable_to_non_nullable -as IList, +as IList,data: freezed == data ? _self.data : data , )); }