From 459f4445c84debc73f3b1efc338002b3ab2baea1 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 7 May 2025 14:39:34 +0200 Subject: [PATCH 1/9] chore(llc, core, ui): bump dependencies --- melos.yaml | 8 +- .../lib/src/core/models/attachment_file.dart | 115 + .../core/models/attachment_file.freezed.dart | 698 +---- .../src/core/models/attachment_file.g.dart | 22 +- .../lib/src/core/models/message_state.dart | 414 +++ .../core/models/message_state.freezed.dart | 2339 ++++------------- .../lib/src/core/models/message_state.g.dart | 84 +- .../lib/src/core/models/poll_voting_mode.dart | 115 + .../core/models/poll_voting_mode.freezed.dart | 555 +--- packages/stream_chat/pubspec.yaml | 4 +- .../lib/src/gallery/gallery_footer.dart | 16 +- .../lib/src/localization/translations.dart | 3 +- packages/stream_chat_flutter/pubspec.yaml | 4 +- .../lib/src/paged_value_notifier.dart | 127 + .../lib/src/paged_value_notifier.freezed.dart | 565 +--- .../lib/src/stream_poll_controller.dart | 134 + .../src/stream_poll_controller.freezed.dart | 841 ++---- .../lib/stream_chat_flutter_core.dart | 6 +- .../stream_chat_flutter_core/pubspec.yaml | 4 +- .../ios/Runner.xcodeproj/project.pbxproj | 6 +- 20 files changed, 1901 insertions(+), 4159 deletions(-) diff --git a/melos.yaml b/melos.yaml index 8ef35f102a..8db2a0c9b8 100644 --- a/melos.yaml +++ b/melos.yaml @@ -49,7 +49,7 @@ command: flutter_secure_storage: ^9.2.2 flutter_slidable: ^3.1.1 flutter_svg: ^2.0.10+1 - freezed_annotation: ^2.4.1 + freezed_annotation: ^3.0.0 gal: ^2.3.1 get_thumbnail_video: ^0.7.3 go_router: ^14.6.2 @@ -59,7 +59,7 @@ command: jiffy: ^6.2.1 jose: ^0.3.4 json_annotation: ^4.9.0 - just_audio: ^0.9.38 + just_audio: ">=0.9.38 <0.11.0" logging: ^1.2.0 lottie: ^3.1.2 media_kit: ^1.1.10+1 @@ -77,7 +77,7 @@ command: responsive_builder: ^0.7.0 rxdart: ^0.28.0 sentry_flutter: ^8.3.0 - share_plus: ^10.0.2 + share_plus: ^11.0.0 shimmer: ^3.0.0 sqlite3_flutter_libs: ^0.5.26 stream_chat: ^9.9.0 @@ -102,7 +102,7 @@ command: fake_async: ^1.3.1 faker_dart: ^0.2.1 flutter_launcher_icons: ^0.14.2 - freezed: ^2.4.2 + freezed: ^3.0.6 json_serializable: ^6.7.1 mocktail: ^1.0.0 path: ^1.8.3 diff --git a/packages/stream_chat/lib/src/core/models/attachment_file.dart b/packages/stream_chat/lib/src/core/models/attachment_file.dart index a796764c6c..b5bb007633 100644 --- a/packages/stream_chat/lib/src/core/models/attachment_file.dart +++ b/packages/stream_chat/lib/src/core/models/attachment_file.dart @@ -139,3 +139,118 @@ sealed class UploadState with _$UploadState { /// Returns true if state is [Failed] bool get isFailed => this is Failed; } + +// coverage:ignore-start + +/// @nodoc +extension UploadStatePatternMatching on UploadState { + /// @nodoc + @optionalTypeArgs + TResult when({ + required TResult Function() preparing, + required TResult Function(int uploaded, int total) inProgress, + required TResult Function() success, + required TResult Function(String error) failed, + }) { + final uploadState = this; + return switch (uploadState) { + Preparing() => preparing(), + InProgress() => inProgress(uploadState.uploaded, uploadState.total), + Success() => success(), + Failed() => failed(uploadState.error), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? preparing, + TResult? Function(int uploaded, int total)? inProgress, + TResult? Function()? success, + TResult? Function(String error)? failed, + }) { + final uploadState = this; + return switch (uploadState) { + Preparing() => preparing?.call(), + InProgress() => inProgress?.call(uploadState.uploaded, uploadState.total), + Success() => success?.call(), + Failed() => failed?.call(uploadState.error), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? preparing, + TResult Function(int uploaded, int total)? inProgress, + TResult Function()? success, + TResult Function(String error)? failed, + required TResult orElse(), + }) { + final uploadState = this; + final result = switch (uploadState) { + Preparing() => preparing?.call(), + InProgress() => inProgress?.call(uploadState.uploaded, uploadState.total), + Success() => success?.call(), + Failed() => failed?.call(uploadState.error), + }; + + return result ?? orElse(); + } + + /// @nodoc + @optionalTypeArgs + TResult map({ + required TResult Function(Preparing value) preparing, + required TResult Function(InProgress value) inProgress, + required TResult Function(Success value) success, + required TResult Function(Failed value) failed, + }) { + final uploadState = this; + return switch (uploadState) { + Preparing() => preparing(uploadState), + InProgress() => inProgress(uploadState), + Success() => success(uploadState), + Failed() => failed(uploadState), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(Preparing value)? preparing, + TResult? Function(InProgress value)? inProgress, + TResult? Function(Success value)? success, + TResult? Function(Failed value)? failed, + }) { + final uploadState = this; + return switch (uploadState) { + Preparing() => preparing?.call(uploadState), + InProgress() => inProgress?.call(uploadState), + Success() => success?.call(uploadState), + Failed() => failed?.call(uploadState), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Preparing value)? preparing, + TResult Function(InProgress value)? inProgress, + TResult Function(Success value)? success, + TResult Function(Failed value)? failed, + required TResult orElse(), + }) { + final uploadState = this; + final result = switch (uploadState) { + Preparing() => preparing?.call(uploadState), + InProgress() => inProgress?.call(uploadState), + Success() => success?.call(uploadState), + Failed() => failed?.call(uploadState), + }; + + return result ?? orElse(); + } +} + +// coverage:ignore-end diff --git a/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart b/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart index 54f7976091..20401e945d 100644 --- a/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart +++ b/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart @@ -1,3 +1,4 @@ +// dart format width=80 // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint @@ -9,11 +10,8 @@ part of 'attachment_file.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - UploadState _$UploadStateFromJson(Map json) { switch (json['runtimeType']) { case 'preparing': @@ -33,123 +31,53 @@ UploadState _$UploadStateFromJson(Map json) { /// @nodoc mixin _$UploadState { - @optionalTypeArgs - TResult when({ - required TResult Function() preparing, - required TResult Function(int uploaded, int total) inProgress, - required TResult Function() success, - required TResult Function(String error) failed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? preparing, - TResult? Function(int uploaded, int total)? inProgress, - TResult? Function()? success, - TResult? Function(String error)? failed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? preparing, - TResult Function(int uploaded, int total)? inProgress, - TResult Function()? success, - TResult Function(String error)? failed, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(Preparing value) preparing, - required TResult Function(InProgress value) inProgress, - required TResult Function(Success value) success, - required TResult Function(Failed value) failed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Preparing value)? preparing, - TResult? Function(InProgress value)? inProgress, - TResult? Function(Success value)? success, - TResult? Function(Failed value)? failed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Preparing value)? preparing, - TResult Function(InProgress value)? inProgress, - TResult Function(Success value)? success, - TResult Function(Failed value)? failed, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - /// Serializes this UploadState to a JSON map. - Map toJson() => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $UploadStateCopyWith<$Res> { - factory $UploadStateCopyWith( - UploadState value, $Res Function(UploadState) then) = - _$UploadStateCopyWithImpl<$Res, UploadState>; -} - -/// @nodoc -class _$UploadStateCopyWithImpl<$Res, $Val extends UploadState> - implements $UploadStateCopyWith<$Res> { - _$UploadStateCopyWithImpl(this._value, this._then); + Map toJson(); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is UploadState); + } - /// Create a copy of UploadState - /// with the given fields replaced by the non-null parameter values. -} + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; -/// @nodoc -abstract class _$$PreparingImplCopyWith<$Res> { - factory _$$PreparingImplCopyWith( - _$PreparingImpl value, $Res Function(_$PreparingImpl) then) = - __$$PreparingImplCopyWithImpl<$Res>; + @override + String toString() { + return 'UploadState()'; + } } /// @nodoc -class __$$PreparingImplCopyWithImpl<$Res> - extends _$UploadStateCopyWithImpl<$Res, _$PreparingImpl> - implements _$$PreparingImplCopyWith<$Res> { - __$$PreparingImplCopyWithImpl( - _$PreparingImpl _value, $Res Function(_$PreparingImpl) _then) - : super(_value, _then); - - /// Create a copy of UploadState - /// with the given fields replaced by the non-null parameter values. +class $UploadStateCopyWith<$Res> { + $UploadStateCopyWith(UploadState _, $Res Function(UploadState) __); } /// @nodoc @JsonSerializable() -class _$PreparingImpl extends Preparing { - const _$PreparingImpl({final String? $type}) +class Preparing extends UploadState { + const Preparing({final String? $type}) : $type = $type ?? 'preparing', super._(); - - factory _$PreparingImpl.fromJson(Map json) => - _$$PreparingImplFromJson(json); + factory Preparing.fromJson(Map json) => + _$PreparingFromJson(json); @JsonKey(name: 'runtimeType') final String $type; @override - String toString() { - return 'UploadState.preparing()'; + Map toJson() { + return _$PreparingToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$PreparingImpl); + (other.runtimeType == runtimeType && other is Preparing); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -157,127 +85,92 @@ class _$PreparingImpl extends Preparing { int get hashCode => runtimeType.hashCode; @override - @optionalTypeArgs - TResult when({ - required TResult Function() preparing, - required TResult Function(int uploaded, int total) inProgress, - required TResult Function() success, - required TResult Function(String error) failed, - }) { - return preparing(); + String toString() { + return 'UploadState.preparing()'; } +} - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? preparing, - TResult? Function(int uploaded, int total)? inProgress, - TResult? Function()? success, - TResult? Function(String error)? failed, - }) { - return preparing?.call(); - } +/// @nodoc +@JsonSerializable() +class InProgress extends UploadState { + const InProgress( + {required this.uploaded, required this.total, final String? $type}) + : $type = $type ?? 'inProgress', + super._(); + factory InProgress.fromJson(Map json) => + _$InProgressFromJson(json); - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? preparing, - TResult Function(int uploaded, int total)? inProgress, - TResult Function()? success, - TResult Function(String error)? failed, - required TResult orElse(), - }) { - if (preparing != null) { - return preparing(); - } - return orElse(); - } + final int uploaded; + final int total; + + @JsonKey(name: 'runtimeType') + final String $type; + + /// Create a copy of UploadState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $InProgressCopyWith get copyWith => + _$InProgressCopyWithImpl(this, _$identity); @override - @optionalTypeArgs - TResult map({ - required TResult Function(Preparing value) preparing, - required TResult Function(InProgress value) inProgress, - required TResult Function(Success value) success, - required TResult Function(Failed value) failed, - }) { - return preparing(this); + Map toJson() { + return _$InProgressToJson( + this, + ); } @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Preparing value)? preparing, - TResult? Function(InProgress value)? inProgress, - TResult? Function(Success value)? success, - TResult? Function(Failed value)? failed, - }) { - return preparing?.call(this); + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is InProgress && + (identical(other.uploaded, uploaded) || + other.uploaded == uploaded) && + (identical(other.total, total) || other.total == total)); } + @JsonKey(includeFromJson: false, includeToJson: false) @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Preparing value)? preparing, - TResult Function(InProgress value)? inProgress, - TResult Function(Success value)? success, - TResult Function(Failed value)? failed, - required TResult orElse(), - }) { - if (preparing != null) { - return preparing(this); - } - return orElse(); - } + int get hashCode => Object.hash(runtimeType, uploaded, total); @override - Map toJson() { - return _$$PreparingImplToJson( - this, - ); + String toString() { + return 'UploadState.inProgress(uploaded: $uploaded, total: $total)'; } } -abstract class Preparing extends UploadState { - const factory Preparing() = _$PreparingImpl; - const Preparing._() : super._(); - - factory Preparing.fromJson(Map json) = - _$PreparingImpl.fromJson; -} - /// @nodoc -abstract class _$$InProgressImplCopyWith<$Res> { - factory _$$InProgressImplCopyWith( - _$InProgressImpl value, $Res Function(_$InProgressImpl) then) = - __$$InProgressImplCopyWithImpl<$Res>; +abstract mixin class $InProgressCopyWith<$Res> + implements $UploadStateCopyWith<$Res> { + factory $InProgressCopyWith( + InProgress value, $Res Function(InProgress) _then) = + _$InProgressCopyWithImpl; @useResult $Res call({int uploaded, int total}); } /// @nodoc -class __$$InProgressImplCopyWithImpl<$Res> - extends _$UploadStateCopyWithImpl<$Res, _$InProgressImpl> - implements _$$InProgressImplCopyWith<$Res> { - __$$InProgressImplCopyWithImpl( - _$InProgressImpl _value, $Res Function(_$InProgressImpl) _then) - : super(_value, _then); +class _$InProgressCopyWithImpl<$Res> implements $InProgressCopyWith<$Res> { + _$InProgressCopyWithImpl(this._self, this._then); + + final InProgress _self; + final $Res Function(InProgress) _then; /// Create a copy of UploadState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') - @override $Res call({ Object? uploaded = null, Object? total = null, }) { - return _then(_$InProgressImpl( + return _then(InProgress( uploaded: null == uploaded - ? _value.uploaded + ? _self.uploaded : uploaded // ignore: cast_nullable_to_non_nullable as int, total: null == total - ? _value.total + ? _self.total : total // ignore: cast_nullable_to_non_nullable as int, )); @@ -286,454 +179,113 @@ class __$$InProgressImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$InProgressImpl extends InProgress { - const _$InProgressImpl( - {required this.uploaded, required this.total, final String? $type}) - : $type = $type ?? 'inProgress', +class Success extends UploadState { + const Success({final String? $type}) + : $type = $type ?? 'success', super._(); - - factory _$InProgressImpl.fromJson(Map json) => - _$$InProgressImplFromJson(json); - - @override - final int uploaded; - @override - final int total; + factory Success.fromJson(Map json) => + _$SuccessFromJson(json); @JsonKey(name: 'runtimeType') final String $type; @override - String toString() { - return 'UploadState.inProgress(uploaded: $uploaded, total: $total)'; + Map toJson() { + return _$SuccessToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$InProgressImpl && - (identical(other.uploaded, uploaded) || - other.uploaded == uploaded) && - (identical(other.total, total) || other.total == total)); + (other.runtimeType == runtimeType && other is Success); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash(runtimeType, uploaded, total); - - /// Create a copy of UploadState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$InProgressImplCopyWith<_$InProgressImpl> get copyWith => - __$$InProgressImplCopyWithImpl<_$InProgressImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() preparing, - required TResult Function(int uploaded, int total) inProgress, - required TResult Function() success, - required TResult Function(String error) failed, - }) { - return inProgress(uploaded, total); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? preparing, - TResult? Function(int uploaded, int total)? inProgress, - TResult? Function()? success, - TResult? Function(String error)? failed, - }) { - return inProgress?.call(uploaded, total); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? preparing, - TResult Function(int uploaded, int total)? inProgress, - TResult Function()? success, - TResult Function(String error)? failed, - required TResult orElse(), - }) { - if (inProgress != null) { - return inProgress(uploaded, total); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Preparing value) preparing, - required TResult Function(InProgress value) inProgress, - required TResult Function(Success value) success, - required TResult Function(Failed value) failed, - }) { - return inProgress(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Preparing value)? preparing, - TResult? Function(InProgress value)? inProgress, - TResult? Function(Success value)? success, - TResult? Function(Failed value)? failed, - }) { - return inProgress?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Preparing value)? preparing, - TResult Function(InProgress value)? inProgress, - TResult Function(Success value)? success, - TResult Function(Failed value)? failed, - required TResult orElse(), - }) { - if (inProgress != null) { - return inProgress(this); - } - return orElse(); - } + int get hashCode => runtimeType.hashCode; @override - Map toJson() { - return _$$InProgressImplToJson( - this, - ); + String toString() { + return 'UploadState.success()'; } } -abstract class InProgress extends UploadState { - const factory InProgress( - {required final int uploaded, - required final int total}) = _$InProgressImpl; - const InProgress._() : super._(); - - factory InProgress.fromJson(Map json) = - _$InProgressImpl.fromJson; - - int get uploaded; - int get total; - - /// Create a copy of UploadState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$InProgressImplCopyWith<_$InProgressImpl> get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class _$$SuccessImplCopyWith<$Res> { - factory _$$SuccessImplCopyWith( - _$SuccessImpl value, $Res Function(_$SuccessImpl) then) = - __$$SuccessImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$SuccessImplCopyWithImpl<$Res> - extends _$UploadStateCopyWithImpl<$Res, _$SuccessImpl> - implements _$$SuccessImplCopyWith<$Res> { - __$$SuccessImplCopyWithImpl( - _$SuccessImpl _value, $Res Function(_$SuccessImpl) _then) - : super(_value, _then); - - /// Create a copy of UploadState - /// with the given fields replaced by the non-null parameter values. -} - /// @nodoc @JsonSerializable() -class _$SuccessImpl extends Success { - const _$SuccessImpl({final String? $type}) - : $type = $type ?? 'success', +class Failed extends UploadState { + const Failed({required this.error, final String? $type}) + : $type = $type ?? 'failed', super._(); + factory Failed.fromJson(Map json) => _$FailedFromJson(json); - factory _$SuccessImpl.fromJson(Map json) => - _$$SuccessImplFromJson(json); + final String error; @JsonKey(name: 'runtimeType') final String $type; + /// Create a copy of UploadState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $FailedCopyWith get copyWith => + _$FailedCopyWithImpl(this, _$identity); + @override - String toString() { - return 'UploadState.success()'; + Map toJson() { + return _$FailedToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$SuccessImpl); + (other.runtimeType == runtimeType && + other is Failed && + (identical(other.error, error) || other.error == error)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => runtimeType.hashCode; - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() preparing, - required TResult Function(int uploaded, int total) inProgress, - required TResult Function() success, - required TResult Function(String error) failed, - }) { - return success(); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? preparing, - TResult? Function(int uploaded, int total)? inProgress, - TResult? Function()? success, - TResult? Function(String error)? failed, - }) { - return success?.call(); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? preparing, - TResult Function(int uploaded, int total)? inProgress, - TResult Function()? success, - TResult Function(String error)? failed, - required TResult orElse(), - }) { - if (success != null) { - return success(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Preparing value) preparing, - required TResult Function(InProgress value) inProgress, - required TResult Function(Success value) success, - required TResult Function(Failed value) failed, - }) { - return success(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Preparing value)? preparing, - TResult? Function(InProgress value)? inProgress, - TResult? Function(Success value)? success, - TResult? Function(Failed value)? failed, - }) { - return success?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Preparing value)? preparing, - TResult Function(InProgress value)? inProgress, - TResult Function(Success value)? success, - TResult Function(Failed value)? failed, - required TResult orElse(), - }) { - if (success != null) { - return success(this); - } - return orElse(); - } + int get hashCode => Object.hash(runtimeType, error); @override - Map toJson() { - return _$$SuccessImplToJson( - this, - ); + String toString() { + return 'UploadState.failed(error: $error)'; } } -abstract class Success extends UploadState { - const factory Success() = _$SuccessImpl; - const Success._() : super._(); - - factory Success.fromJson(Map json) = _$SuccessImpl.fromJson; -} - /// @nodoc -abstract class _$$FailedImplCopyWith<$Res> { - factory _$$FailedImplCopyWith( - _$FailedImpl value, $Res Function(_$FailedImpl) then) = - __$$FailedImplCopyWithImpl<$Res>; +abstract mixin class $FailedCopyWith<$Res> + implements $UploadStateCopyWith<$Res> { + factory $FailedCopyWith(Failed value, $Res Function(Failed) _then) = + _$FailedCopyWithImpl; @useResult $Res call({String error}); } /// @nodoc -class __$$FailedImplCopyWithImpl<$Res> - extends _$UploadStateCopyWithImpl<$Res, _$FailedImpl> - implements _$$FailedImplCopyWith<$Res> { - __$$FailedImplCopyWithImpl( - _$FailedImpl _value, $Res Function(_$FailedImpl) _then) - : super(_value, _then); +class _$FailedCopyWithImpl<$Res> implements $FailedCopyWith<$Res> { + _$FailedCopyWithImpl(this._self, this._then); + + final Failed _self; + final $Res Function(Failed) _then; /// Create a copy of UploadState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') - @override $Res call({ Object? error = null, }) { - return _then(_$FailedImpl( + return _then(Failed( error: null == error - ? _value.error + ? _self.error : error // ignore: cast_nullable_to_non_nullable as String, )); } } -/// @nodoc -@JsonSerializable() -class _$FailedImpl extends Failed { - const _$FailedImpl({required this.error, final String? $type}) - : $type = $type ?? 'failed', - super._(); - - factory _$FailedImpl.fromJson(Map json) => - _$$FailedImplFromJson(json); - - @override - final String error; - - @JsonKey(name: 'runtimeType') - final String $type; - - @override - String toString() { - return 'UploadState.failed(error: $error)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$FailedImpl && - (identical(other.error, error) || other.error == error)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, error); - - /// Create a copy of UploadState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$FailedImplCopyWith<_$FailedImpl> get copyWith => - __$$FailedImplCopyWithImpl<_$FailedImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() preparing, - required TResult Function(int uploaded, int total) inProgress, - required TResult Function() success, - required TResult Function(String error) failed, - }) { - return failed(error); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? preparing, - TResult? Function(int uploaded, int total)? inProgress, - TResult? Function()? success, - TResult? Function(String error)? failed, - }) { - return failed?.call(error); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? preparing, - TResult Function(int uploaded, int total)? inProgress, - TResult Function()? success, - TResult Function(String error)? failed, - required TResult orElse(), - }) { - if (failed != null) { - return failed(error); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Preparing value) preparing, - required TResult Function(InProgress value) inProgress, - required TResult Function(Success value) success, - required TResult Function(Failed value) failed, - }) { - return failed(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Preparing value)? preparing, - TResult? Function(InProgress value)? inProgress, - TResult? Function(Success value)? success, - TResult? Function(Failed value)? failed, - }) { - return failed?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Preparing value)? preparing, - TResult Function(InProgress value)? inProgress, - TResult Function(Success value)? success, - TResult Function(Failed value)? failed, - required TResult orElse(), - }) { - if (failed != null) { - return failed(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$FailedImplToJson( - this, - ); - } -} - -abstract class Failed extends UploadState { - const factory Failed({required final String error}) = _$FailedImpl; - const Failed._() : super._(); - - factory Failed.fromJson(Map json) = _$FailedImpl.fromJson; - - String get error; - - /// Create a copy of UploadState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$FailedImplCopyWith<_$FailedImpl> get copyWith => - throw _privateConstructorUsedError; -} +// dart format on diff --git a/packages/stream_chat/lib/src/core/models/attachment_file.g.dart b/packages/stream_chat/lib/src/core/models/attachment_file.g.dart index 6b385f2bbb..256713cae0 100644 --- a/packages/stream_chat/lib/src/core/models/attachment_file.g.dart +++ b/packages/stream_chat/lib/src/core/models/attachment_file.g.dart @@ -20,47 +20,41 @@ Map _$AttachmentFileToJson(AttachmentFile instance) => 'size': instance.size, }; -_$PreparingImpl _$$PreparingImplFromJson(Map json) => - _$PreparingImpl( +Preparing _$PreparingFromJson(Map json) => Preparing( $type: json['runtimeType'] as String?, ); -Map _$$PreparingImplToJson(_$PreparingImpl instance) => - { +Map _$PreparingToJson(Preparing instance) => { 'runtimeType': instance.$type, }; -_$InProgressImpl _$$InProgressImplFromJson(Map json) => - _$InProgressImpl( +InProgress _$InProgressFromJson(Map json) => InProgress( uploaded: (json['uploaded'] as num).toInt(), total: (json['total'] as num).toInt(), $type: json['runtimeType'] as String?, ); -Map _$$InProgressImplToJson(_$InProgressImpl instance) => +Map _$InProgressToJson(InProgress instance) => { 'uploaded': instance.uploaded, 'total': instance.total, 'runtimeType': instance.$type, }; -_$SuccessImpl _$$SuccessImplFromJson(Map json) => - _$SuccessImpl( +Success _$SuccessFromJson(Map json) => Success( $type: json['runtimeType'] as String?, ); -Map _$$SuccessImplToJson(_$SuccessImpl instance) => - { +Map _$SuccessToJson(Success instance) => { 'runtimeType': instance.$type, }; -_$FailedImpl _$$FailedImplFromJson(Map json) => _$FailedImpl( +Failed _$FailedFromJson(Map json) => Failed( error: json['error'] as String, $type: json['runtimeType'] as String?, ); -Map _$$FailedImplToJson(_$FailedImpl instance) => - { +Map _$FailedToJson(Failed instance) => { 'error': instance.error, 'runtimeType': instance.$type, }; diff --git a/packages/stream_chat/lib/src/core/models/message_state.dart b/packages/stream_chat/lib/src/core/models/message_state.dart index 06ca52fe93..eccfe3345f 100644 --- a/packages/stream_chat/lib/src/core/models/message_state.dart +++ b/packages/stream_chat/lib/src/core/models/message_state.dart @@ -1,3 +1,5 @@ +// ignore_for_file: avoid_positional_boolean_parameters + import 'package:freezed_annotation/freezed_annotation.dart'; part 'message_state.freezed.dart'; @@ -297,3 +299,415 @@ sealed class FailedState with _$FailedState { factory FailedState.fromJson(Map json) => _$FailedStateFromJson(json); } + +// coverage:ignore-start + +/// @nodoc +extension MessageStatePatternMatching on MessageState { + /// @nodoc + @optionalTypeArgs + TResult when({ + required TResult Function() initial, + required TResult Function(OutgoingState state) outgoing, + required TResult Function(CompletedState state) completed, + required TResult Function(FailedState state, Object? reason) failed, + }) { + final messageState = this; + return switch (messageState) { + MessageInitial() => initial(), + MessageOutgoing() => outgoing(messageState.state), + MessageCompleted() => completed(messageState.state), + MessageFailed() => failed(messageState.state, messageState.reason), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? initial, + TResult? Function(OutgoingState state)? outgoing, + TResult? Function(CompletedState state)? completed, + TResult? Function(FailedState state, Object? reason)? failed, + }) { + final messageState = this; + return switch (messageState) { + MessageInitial() => initial?.call(), + MessageOutgoing() => outgoing?.call(messageState.state), + MessageCompleted() => completed?.call(messageState.state), + MessageFailed() => failed?.call(messageState.state, messageState.reason), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? initial, + TResult Function(OutgoingState state)? outgoing, + TResult Function(CompletedState state)? completed, + TResult Function(FailedState state, Object? reason)? failed, + required TResult orElse(), + }) { + final messageState = this; + final result = switch (messageState) { + MessageInitial() => initial?.call(), + MessageOutgoing() => outgoing?.call(messageState.state), + MessageCompleted() => completed?.call(messageState.state), + MessageFailed() => failed?.call(messageState.state, messageState.reason), + }; + + return result ?? orElse(); + } + + /// @nodoc + @optionalTypeArgs + TResult map({ + required TResult Function(MessageInitial value) initial, + required TResult Function(MessageOutgoing value) outgoing, + required TResult Function(MessageCompleted value) completed, + required TResult Function(MessageFailed value) failed, + }) { + final messageState = this; + return switch (messageState) { + MessageInitial() => initial(messageState), + MessageOutgoing() => outgoing(messageState), + MessageCompleted() => completed(messageState), + MessageFailed() => failed(messageState), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(MessageInitial value)? initial, + TResult? Function(MessageOutgoing value)? outgoing, + TResult? Function(MessageCompleted value)? completed, + TResult? Function(MessageFailed value)? failed, + }) { + final messageState = this; + return switch (messageState) { + MessageInitial() => initial?.call(messageState), + MessageOutgoing() => outgoing?.call(messageState), + MessageCompleted() => completed?.call(messageState), + MessageFailed() => failed?.call(messageState), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeMap({ + TResult Function(MessageInitial value)? initial, + TResult Function(MessageOutgoing value)? outgoing, + TResult Function(MessageCompleted value)? completed, + TResult Function(MessageFailed value)? failed, + required TResult orElse(), + }) { + final messageState = this; + final result = switch (messageState) { + MessageInitial() => initial?.call(messageState), + MessageOutgoing() => outgoing?.call(messageState), + MessageCompleted() => completed?.call(messageState), + MessageFailed() => failed?.call(messageState), + }; + + return result ?? orElse(); + } +} + +/// @nodoc +extension OutgoingStatePatternMatching on OutgoingState { + /// @nodoc + @optionalTypeArgs + TResult when({ + required TResult Function() sending, + required TResult Function() updating, + required TResult Function(bool hard) deleting, + }) { + final outgoingState = this; + return switch (outgoingState) { + Sending() => sending(), + Updating() => updating(), + Deleting() => deleting(outgoingState.hard), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? sending, + TResult? Function()? updating, + TResult? Function(bool hard)? deleting, + }) { + final outgoingState = this; + return switch (outgoingState) { + Sending() => sending?.call(), + Updating() => updating?.call(), + Deleting() => deleting?.call(outgoingState.hard), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? sending, + TResult Function()? updating, + TResult Function(bool hard)? deleting, + required TResult orElse(), + }) { + final outgoingState = this; + final result = switch (outgoingState) { + Sending() => sending?.call(), + Updating() => updating?.call(), + Deleting() => deleting?.call(outgoingState.hard), + }; + + return result ?? orElse(); + } + + /// @nodoc + @optionalTypeArgs + TResult map({ + required TResult Function(Sending value) sending, + required TResult Function(Updating value) updating, + required TResult Function(Deleting value) deleting, + }) { + final outgoingState = this; + return switch (outgoingState) { + Sending() => sending(outgoingState), + Updating() => updating(outgoingState), + Deleting() => deleting(outgoingState), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(Sending value)? sending, + TResult? Function(Updating value)? updating, + TResult? Function(Deleting value)? deleting, + }) { + final outgoingState = this; + return switch (outgoingState) { + Sending() => sending?.call(outgoingState), + Updating() => updating?.call(outgoingState), + Deleting() => deleting?.call(outgoingState), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Sending value)? sending, + TResult Function(Updating value)? updating, + TResult Function(Deleting value)? deleting, + required TResult orElse(), + }) { + final outgoingState = this; + final result = switch (outgoingState) { + Sending() => sending?.call(outgoingState), + Updating() => updating?.call(outgoingState), + Deleting() => deleting?.call(outgoingState), + }; + + return result ?? orElse(); + } +} + +/// @nodoc +extension CompletedStatePatternMatching on CompletedState { + /// @nodoc + @optionalTypeArgs + TResult when({ + required TResult Function() sent, + required TResult Function() updated, + required TResult Function(bool hard) deleted, + }) { + final completedState = this; + return switch (completedState) { + Sent() => sent(), + Updated() => updated(), + Deleted() => deleted(completedState.hard), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? sent, + TResult? Function()? updated, + TResult? Function(bool hard)? deleted, + }) { + final completedState = this; + return switch (completedState) { + Sent() => sent?.call(), + Updated() => updated?.call(), + Deleted() => deleted?.call(completedState.hard), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? sent, + TResult Function()? updated, + TResult Function(bool hard)? deleted, + required TResult orElse(), + }) { + final completedState = this; + final result = switch (completedState) { + Sent() => sent?.call(), + Updated() => updated?.call(), + Deleted() => deleted?.call(completedState.hard), + }; + + return result ?? orElse(); + } + + /// @nodoc + @optionalTypeArgs + TResult map({ + required TResult Function(Sent value) sent, + required TResult Function(Updated value) updated, + required TResult Function(Deleted value) deleted, + }) { + final completedState = this; + return switch (completedState) { + Sent() => sent(completedState), + Updated() => updated(completedState), + Deleted() => deleted(completedState), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(Sent value)? sent, + TResult? Function(Updated value)? updated, + TResult? Function(Deleted value)? deleted, + }) { + final completedState = this; + return switch (completedState) { + Sent() => sent?.call(completedState), + Updated() => updated?.call(completedState), + Deleted() => deleted?.call(completedState), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeMap({ + TResult Function(Sent value)? sent, + TResult Function(Updated value)? updated, + TResult Function(Deleted value)? deleted, + required TResult orElse(), + }) { + final completedState = this; + final result = switch (completedState) { + Sent() => sent?.call(completedState), + Updated() => updated?.call(completedState), + Deleted() => deleted?.call(completedState), + }; + + return result ?? orElse(); + } +} + +/// @nodoc +extension FailedStatePatternMatching on FailedState { + /// @nodoc + @optionalTypeArgs + TResult when({ + required TResult Function() sendingFailed, + required TResult Function() updatingFailed, + required TResult Function(bool hard) deletingFailed, + }) { + final failedState = this; + return switch (failedState) { + SendingFailed() => sendingFailed(), + UpdatingFailed() => updatingFailed(), + DeletingFailed() => deletingFailed(failedState.hard), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? sendingFailed, + TResult? Function()? updatingFailed, + TResult? Function(bool hard)? deletingFailed, + }) { + final failedState = this; + return switch (failedState) { + SendingFailed() => sendingFailed?.call(), + UpdatingFailed() => updatingFailed?.call(), + DeletingFailed() => deletingFailed?.call(failedState.hard), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? sendingFailed, + TResult Function()? updatingFailed, + TResult Function(bool hard)? deletingFailed, + required TResult orElse(), + }) { + final failedState = this; + final result = switch (failedState) { + SendingFailed() => sendingFailed?.call(), + UpdatingFailed() => updatingFailed?.call(), + DeletingFailed() => deletingFailed?.call(failedState.hard), + }; + + return result ?? orElse(); + } + + /// @nodoc + @optionalTypeArgs + TResult map({ + required TResult Function(SendingFailed value) sendingFailed, + required TResult Function(UpdatingFailed value) updatingFailed, + required TResult Function(DeletingFailed value) deletingFailed, + }) { + final failedState = this; + return switch (failedState) { + SendingFailed() => sendingFailed(failedState), + UpdatingFailed() => updatingFailed(failedState), + DeletingFailed() => deletingFailed(failedState), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SendingFailed value)? sendingFailed, + TResult? Function(UpdatingFailed value)? updatingFailed, + TResult? Function(DeletingFailed value)? deletingFailed, + }) { + final failedState = this; + return switch (failedState) { + SendingFailed() => sendingFailed?.call(failedState), + UpdatingFailed() => updatingFailed?.call(failedState), + DeletingFailed() => deletingFailed?.call(failedState), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SendingFailed value)? sendingFailed, + TResult Function(UpdatingFailed value)? updatingFailed, + TResult Function(DeletingFailed value)? deletingFailed, + required TResult orElse(), + }) { + final failedState = this; + final result = switch (failedState) { + SendingFailed() => sendingFailed?.call(failedState), + UpdatingFailed() => updatingFailed?.call(failedState), + DeletingFailed() => deletingFailed?.call(failedState), + }; + + return result ?? orElse(); + } +} + +// coverage:ignore-end \ No newline at end of file diff --git a/packages/stream_chat/lib/src/core/models/message_state.freezed.dart b/packages/stream_chat/lib/src/core/models/message_state.freezed.dart index 584bc54b4c..079d8b3696 100644 --- a/packages/stream_chat/lib/src/core/models/message_state.freezed.dart +++ b/packages/stream_chat/lib/src/core/models/message_state.freezed.dart @@ -1,3 +1,4 @@ +// dart format width=80 // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint @@ -9,11 +10,8 @@ part of 'message_state.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - MessageState _$MessageStateFromJson(Map json) { switch (json['runtimeType']) { case 'initial': @@ -33,122 +31,51 @@ MessageState _$MessageStateFromJson(Map json) { /// @nodoc mixin _$MessageState { - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(OutgoingState state) outgoing, - required TResult Function(CompletedState state) completed, - required TResult Function(FailedState state, Object? reason) failed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(OutgoingState state)? outgoing, - TResult? Function(CompletedState state)? completed, - TResult? Function(FailedState state, Object? reason)? failed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(OutgoingState state)? outgoing, - TResult Function(CompletedState state)? completed, - TResult Function(FailedState state, Object? reason)? failed, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(MessageInitial value) initial, - required TResult Function(MessageOutgoing value) outgoing, - required TResult Function(MessageCompleted value) completed, - required TResult Function(MessageFailed value) failed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(MessageInitial value)? initial, - TResult? Function(MessageOutgoing value)? outgoing, - TResult? Function(MessageCompleted value)? completed, - TResult? Function(MessageFailed value)? failed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(MessageInitial value)? initial, - TResult Function(MessageOutgoing value)? outgoing, - TResult Function(MessageCompleted value)? completed, - TResult Function(MessageFailed value)? failed, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - /// Serializes this MessageState to a JSON map. - Map toJson() => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $MessageStateCopyWith<$Res> { - factory $MessageStateCopyWith( - MessageState value, $Res Function(MessageState) then) = - _$MessageStateCopyWithImpl<$Res, MessageState>; -} - -/// @nodoc -class _$MessageStateCopyWithImpl<$Res, $Val extends MessageState> - implements $MessageStateCopyWith<$Res> { - _$MessageStateCopyWithImpl(this._value, this._then); + Map toJson(); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is MessageState); + } - /// Create a copy of MessageState - /// with the given fields replaced by the non-null parameter values. -} + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; -/// @nodoc -abstract class _$$MessageInitialImplCopyWith<$Res> { - factory _$$MessageInitialImplCopyWith(_$MessageInitialImpl value, - $Res Function(_$MessageInitialImpl) then) = - __$$MessageInitialImplCopyWithImpl<$Res>; + @override + String toString() { + return 'MessageState()'; + } } /// @nodoc -class __$$MessageInitialImplCopyWithImpl<$Res> - extends _$MessageStateCopyWithImpl<$Res, _$MessageInitialImpl> - implements _$$MessageInitialImplCopyWith<$Res> { - __$$MessageInitialImplCopyWithImpl( - _$MessageInitialImpl _value, $Res Function(_$MessageInitialImpl) _then) - : super(_value, _then); - - /// Create a copy of MessageState - /// with the given fields replaced by the non-null parameter values. +class $MessageStateCopyWith<$Res> { + $MessageStateCopyWith(MessageState _, $Res Function(MessageState) __); } /// @nodoc @JsonSerializable() -class _$MessageInitialImpl implements MessageInitial { - const _$MessageInitialImpl({final String? $type}) - : $type = $type ?? 'initial'; - - factory _$MessageInitialImpl.fromJson(Map json) => - _$$MessageInitialImplFromJson(json); +class MessageInitial implements MessageState { + const MessageInitial({final String? $type}) : $type = $type ?? 'initial'; + factory MessageInitial.fromJson(Map json) => + _$MessageInitialFromJson(json); @JsonKey(name: 'runtimeType') final String $type; @override - String toString() { - return 'MessageState.initial()'; + Map toJson() { + return _$MessageInitialToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$MessageInitialImpl); + (other.runtimeType == runtimeType && other is MessageInitial); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -156,99 +83,62 @@ class _$MessageInitialImpl implements MessageInitial { int get hashCode => runtimeType.hashCode; @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(OutgoingState state) outgoing, - required TResult Function(CompletedState state) completed, - required TResult Function(FailedState state, Object? reason) failed, - }) { - return initial(); + String toString() { + return 'MessageState.initial()'; } +} - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(OutgoingState state)? outgoing, - TResult? Function(CompletedState state)? completed, - TResult? Function(FailedState state, Object? reason)? failed, - }) { - return initial?.call(); - } +/// @nodoc +@JsonSerializable() +class MessageOutgoing implements MessageState { + const MessageOutgoing({required this.state, final String? $type}) + : $type = $type ?? 'outgoing'; + factory MessageOutgoing.fromJson(Map json) => + _$MessageOutgoingFromJson(json); - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(OutgoingState state)? outgoing, - TResult Function(CompletedState state)? completed, - TResult Function(FailedState state, Object? reason)? failed, - required TResult orElse(), - }) { - if (initial != null) { - return initial(); - } - return orElse(); - } + final OutgoingState state; + + @JsonKey(name: 'runtimeType') + final String $type; + + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageOutgoingCopyWith get copyWith => + _$MessageOutgoingCopyWithImpl(this, _$identity); @override - @optionalTypeArgs - TResult map({ - required TResult Function(MessageInitial value) initial, - required TResult Function(MessageOutgoing value) outgoing, - required TResult Function(MessageCompleted value) completed, - required TResult Function(MessageFailed value) failed, - }) { - return initial(this); + Map toJson() { + return _$MessageOutgoingToJson( + this, + ); } @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(MessageInitial value)? initial, - TResult? Function(MessageOutgoing value)? outgoing, - TResult? Function(MessageCompleted value)? completed, - TResult? Function(MessageFailed value)? failed, - }) { - return initial?.call(this); + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageOutgoing && + (identical(other.state, state) || other.state == state)); } + @JsonKey(includeFromJson: false, includeToJson: false) @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(MessageInitial value)? initial, - TResult Function(MessageOutgoing value)? outgoing, - TResult Function(MessageCompleted value)? completed, - TResult Function(MessageFailed value)? failed, - required TResult orElse(), - }) { - if (initial != null) { - return initial(this); - } - return orElse(); - } + int get hashCode => Object.hash(runtimeType, state); @override - Map toJson() { - return _$$MessageInitialImplToJson( - this, - ); + String toString() { + return 'MessageState.outgoing(state: $state)'; } } -abstract class MessageInitial implements MessageState { - const factory MessageInitial() = _$MessageInitialImpl; - - factory MessageInitial.fromJson(Map json) = - _$MessageInitialImpl.fromJson; -} - /// @nodoc -abstract class _$$MessageOutgoingImplCopyWith<$Res> { - factory _$$MessageOutgoingImplCopyWith(_$MessageOutgoingImpl value, - $Res Function(_$MessageOutgoingImpl) then) = - __$$MessageOutgoingImplCopyWithImpl<$Res>; +abstract mixin class $MessageOutgoingCopyWith<$Res> + implements $MessageStateCopyWith<$Res> { + factory $MessageOutgoingCopyWith( + MessageOutgoing value, $Res Function(MessageOutgoing) _then) = + _$MessageOutgoingCopyWithImpl; @useResult $Res call({OutgoingState state}); @@ -256,23 +146,22 @@ abstract class _$$MessageOutgoingImplCopyWith<$Res> { } /// @nodoc -class __$$MessageOutgoingImplCopyWithImpl<$Res> - extends _$MessageStateCopyWithImpl<$Res, _$MessageOutgoingImpl> - implements _$$MessageOutgoingImplCopyWith<$Res> { - __$$MessageOutgoingImplCopyWithImpl( - _$MessageOutgoingImpl _value, $Res Function(_$MessageOutgoingImpl) _then) - : super(_value, _then); +class _$MessageOutgoingCopyWithImpl<$Res> + implements $MessageOutgoingCopyWith<$Res> { + _$MessageOutgoingCopyWithImpl(this._self, this._then); + + final MessageOutgoing _self; + final $Res Function(MessageOutgoing) _then; /// Create a copy of MessageState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') - @override $Res call({ Object? state = null, }) { - return _then(_$MessageOutgoingImpl( + return _then(MessageOutgoing( state: null == state - ? _value.state + ? _self.state : state // ignore: cast_nullable_to_non_nullable as OutgoingState, )); @@ -283,37 +172,44 @@ class __$$MessageOutgoingImplCopyWithImpl<$Res> @override @pragma('vm:prefer-inline') $OutgoingStateCopyWith<$Res> get state { - return $OutgoingStateCopyWith<$Res>(_value.state, (value) { - return _then(_value.copyWith(state: value)); + return $OutgoingStateCopyWith<$Res>(_self.state, (value) { + return _then(_self.copyWith(state: value)); }); } } /// @nodoc @JsonSerializable() -class _$MessageOutgoingImpl implements MessageOutgoing { - const _$MessageOutgoingImpl({required this.state, final String? $type}) - : $type = $type ?? 'outgoing'; - - factory _$MessageOutgoingImpl.fromJson(Map json) => - _$$MessageOutgoingImplFromJson(json); +class MessageCompleted implements MessageState { + const MessageCompleted({required this.state, final String? $type}) + : $type = $type ?? 'completed'; + factory MessageCompleted.fromJson(Map json) => + _$MessageCompletedFromJson(json); - @override - final OutgoingState state; + final CompletedState state; @JsonKey(name: 'runtimeType') final String $type; + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $MessageCompletedCopyWith get copyWith => + _$MessageCompletedCopyWithImpl(this, _$identity); + @override - String toString() { - return 'MessageState.outgoing(state: $state)'; + Map toJson() { + return _$MessageCompletedToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$MessageOutgoingImpl && + other is MessageCompleted && (identical(other.state, state) || other.state == state)); } @@ -321,118 +217,18 @@ class _$MessageOutgoingImpl implements MessageOutgoing { @override int get hashCode => Object.hash(runtimeType, state); - /// Create a copy of MessageState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$MessageOutgoingImplCopyWith<_$MessageOutgoingImpl> get copyWith => - __$$MessageOutgoingImplCopyWithImpl<_$MessageOutgoingImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(OutgoingState state) outgoing, - required TResult Function(CompletedState state) completed, - required TResult Function(FailedState state, Object? reason) failed, - }) { - return outgoing(state); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(OutgoingState state)? outgoing, - TResult? Function(CompletedState state)? completed, - TResult? Function(FailedState state, Object? reason)? failed, - }) { - return outgoing?.call(state); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(OutgoingState state)? outgoing, - TResult Function(CompletedState state)? completed, - TResult Function(FailedState state, Object? reason)? failed, - required TResult orElse(), - }) { - if (outgoing != null) { - return outgoing(state); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(MessageInitial value) initial, - required TResult Function(MessageOutgoing value) outgoing, - required TResult Function(MessageCompleted value) completed, - required TResult Function(MessageFailed value) failed, - }) { - return outgoing(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(MessageInitial value)? initial, - TResult? Function(MessageOutgoing value)? outgoing, - TResult? Function(MessageCompleted value)? completed, - TResult? Function(MessageFailed value)? failed, - }) { - return outgoing?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(MessageInitial value)? initial, - TResult Function(MessageOutgoing value)? outgoing, - TResult Function(MessageCompleted value)? completed, - TResult Function(MessageFailed value)? failed, - required TResult orElse(), - }) { - if (outgoing != null) { - return outgoing(this); - } - return orElse(); - } - @override - Map toJson() { - return _$$MessageOutgoingImplToJson( - this, - ); + String toString() { + return 'MessageState.completed(state: $state)'; } } -abstract class MessageOutgoing implements MessageState { - const factory MessageOutgoing({required final OutgoingState state}) = - _$MessageOutgoingImpl; - - factory MessageOutgoing.fromJson(Map json) = - _$MessageOutgoingImpl.fromJson; - - OutgoingState get state; - - /// Create a copy of MessageState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$MessageOutgoingImplCopyWith<_$MessageOutgoingImpl> get copyWith => - throw _privateConstructorUsedError; -} - /// @nodoc -abstract class _$$MessageCompletedImplCopyWith<$Res> { - factory _$$MessageCompletedImplCopyWith(_$MessageCompletedImpl value, - $Res Function(_$MessageCompletedImpl) then) = - __$$MessageCompletedImplCopyWithImpl<$Res>; +abstract mixin class $MessageCompletedCopyWith<$Res> + implements $MessageStateCopyWith<$Res> { + factory $MessageCompletedCopyWith( + MessageCompleted value, $Res Function(MessageCompleted) _then) = + _$MessageCompletedCopyWithImpl; @useResult $Res call({CompletedState state}); @@ -440,23 +236,22 @@ abstract class _$$MessageCompletedImplCopyWith<$Res> { } /// @nodoc -class __$$MessageCompletedImplCopyWithImpl<$Res> - extends _$MessageStateCopyWithImpl<$Res, _$MessageCompletedImpl> - implements _$$MessageCompletedImplCopyWith<$Res> { - __$$MessageCompletedImplCopyWithImpl(_$MessageCompletedImpl _value, - $Res Function(_$MessageCompletedImpl) _then) - : super(_value, _then); +class _$MessageCompletedCopyWithImpl<$Res> + implements $MessageCompletedCopyWith<$Res> { + _$MessageCompletedCopyWithImpl(this._self, this._then); + + final MessageCompleted _self; + final $Res Function(MessageCompleted) _then; /// Create a copy of MessageState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') - @override $Res call({ Object? state = null, }) { - return _then(_$MessageCompletedImpl( + return _then(MessageCompleted( state: null == state - ? _value.state + ? _self.state : state // ignore: cast_nullable_to_non_nullable as CompletedState, )); @@ -467,156 +262,66 @@ class __$$MessageCompletedImplCopyWithImpl<$Res> @override @pragma('vm:prefer-inline') $CompletedStateCopyWith<$Res> get state { - return $CompletedStateCopyWith<$Res>(_value.state, (value) { - return _then(_value.copyWith(state: value)); + return $CompletedStateCopyWith<$Res>(_self.state, (value) { + return _then(_self.copyWith(state: value)); }); } } /// @nodoc @JsonSerializable() -class _$MessageCompletedImpl implements MessageCompleted { - const _$MessageCompletedImpl({required this.state, final String? $type}) - : $type = $type ?? 'completed'; - - factory _$MessageCompletedImpl.fromJson(Map json) => - _$$MessageCompletedImplFromJson(json); +class MessageFailed implements MessageState { + const MessageFailed({required this.state, this.reason, final String? $type}) + : $type = $type ?? 'failed'; + factory MessageFailed.fromJson(Map json) => + _$MessageFailedFromJson(json); - @override - final CompletedState state; + final FailedState state; + final Object? reason; @JsonKey(name: 'runtimeType') final String $type; - @override - String toString() { - return 'MessageState.completed(state: $state)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$MessageCompletedImpl && - (identical(other.state, state) || other.state == state)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, state); - /// Create a copy of MessageState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) - @override @pragma('vm:prefer-inline') - _$$MessageCompletedImplCopyWith<_$MessageCompletedImpl> get copyWith => - __$$MessageCompletedImplCopyWithImpl<_$MessageCompletedImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(OutgoingState state) outgoing, - required TResult Function(CompletedState state) completed, - required TResult Function(FailedState state, Object? reason) failed, - }) { - return completed(state); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(OutgoingState state)? outgoing, - TResult? Function(CompletedState state)? completed, - TResult? Function(FailedState state, Object? reason)? failed, - }) { - return completed?.call(state); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(OutgoingState state)? outgoing, - TResult Function(CompletedState state)? completed, - TResult Function(FailedState state, Object? reason)? failed, - required TResult orElse(), - }) { - if (completed != null) { - return completed(state); - } - return orElse(); - } + $MessageFailedCopyWith get copyWith => + _$MessageFailedCopyWithImpl(this, _$identity); @override - @optionalTypeArgs - TResult map({ - required TResult Function(MessageInitial value) initial, - required TResult Function(MessageOutgoing value) outgoing, - required TResult Function(MessageCompleted value) completed, - required TResult Function(MessageFailed value) failed, - }) { - return completed(this); + Map toJson() { + return _$MessageFailedToJson( + this, + ); } @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(MessageInitial value)? initial, - TResult? Function(MessageOutgoing value)? outgoing, - TResult? Function(MessageCompleted value)? completed, - TResult? Function(MessageFailed value)? failed, - }) { - return completed?.call(this); + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is MessageFailed && + (identical(other.state, state) || other.state == state) && + const DeepCollectionEquality().equals(other.reason, reason)); } + @JsonKey(includeFromJson: false, includeToJson: false) @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(MessageInitial value)? initial, - TResult Function(MessageOutgoing value)? outgoing, - TResult Function(MessageCompleted value)? completed, - TResult Function(MessageFailed value)? failed, - required TResult orElse(), - }) { - if (completed != null) { - return completed(this); - } - return orElse(); - } + int get hashCode => Object.hash( + runtimeType, state, const DeepCollectionEquality().hash(reason)); @override - Map toJson() { - return _$$MessageCompletedImplToJson( - this, - ); + String toString() { + return 'MessageState.failed(state: $state, reason: $reason)'; } } -abstract class MessageCompleted implements MessageState { - const factory MessageCompleted({required final CompletedState state}) = - _$MessageCompletedImpl; - - factory MessageCompleted.fromJson(Map json) = - _$MessageCompletedImpl.fromJson; - - CompletedState get state; - - /// Create a copy of MessageState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$MessageCompletedImplCopyWith<_$MessageCompletedImpl> get copyWith => - throw _privateConstructorUsedError; -} - /// @nodoc -abstract class _$$MessageFailedImplCopyWith<$Res> { - factory _$$MessageFailedImplCopyWith( - _$MessageFailedImpl value, $Res Function(_$MessageFailedImpl) then) = - __$$MessageFailedImplCopyWithImpl<$Res>; +abstract mixin class $MessageFailedCopyWith<$Res> + implements $MessageStateCopyWith<$Res> { + factory $MessageFailedCopyWith( + MessageFailed value, $Res Function(MessageFailed) _then) = + _$MessageFailedCopyWithImpl; @useResult $Res call({FailedState state, Object? reason}); @@ -624,27 +329,26 @@ abstract class _$$MessageFailedImplCopyWith<$Res> { } /// @nodoc -class __$$MessageFailedImplCopyWithImpl<$Res> - extends _$MessageStateCopyWithImpl<$Res, _$MessageFailedImpl> - implements _$$MessageFailedImplCopyWith<$Res> { - __$$MessageFailedImplCopyWithImpl( - _$MessageFailedImpl _value, $Res Function(_$MessageFailedImpl) _then) - : super(_value, _then); +class _$MessageFailedCopyWithImpl<$Res> + implements $MessageFailedCopyWith<$Res> { + _$MessageFailedCopyWithImpl(this._self, this._then); + + final MessageFailed _self; + final $Res Function(MessageFailed) _then; /// Create a copy of MessageState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') - @override $Res call({ Object? state = null, Object? reason = freezed, }) { - return _then(_$MessageFailedImpl( + return _then(MessageFailed( state: null == state - ? _value.state + ? _self.state : state // ignore: cast_nullable_to_non_nullable as FailedState, - reason: freezed == reason ? _value.reason : reason, + reason: freezed == reason ? _self.reason : reason, )); } @@ -653,410 +357,107 @@ class __$$MessageFailedImplCopyWithImpl<$Res> @override @pragma('vm:prefer-inline') $FailedStateCopyWith<$Res> get state { - return $FailedStateCopyWith<$Res>(_value.state, (value) { - return _then(_value.copyWith(state: value)); + return $FailedStateCopyWith<$Res>(_self.state, (value) { + return _then(_self.copyWith(state: value)); }); } } +OutgoingState _$OutgoingStateFromJson(Map json) { + switch (json['runtimeType']) { + case 'sending': + return Sending.fromJson(json); + case 'updating': + return Updating.fromJson(json); + case 'deleting': + return Deleting.fromJson(json); + + default: + throw CheckedFromJsonException(json, 'runtimeType', 'OutgoingState', + 'Invalid union type "${json['runtimeType']}"!'); + } +} + /// @nodoc -@JsonSerializable() -class _$MessageFailedImpl implements MessageFailed { - const _$MessageFailedImpl( - {required this.state, this.reason, final String? $type}) - : $type = $type ?? 'failed'; +mixin _$OutgoingState { + /// Serializes this OutgoingState to a JSON map. + Map toJson(); - factory _$MessageFailedImpl.fromJson(Map json) => - _$$MessageFailedImplFromJson(json); + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is OutgoingState); + } + @JsonKey(includeFromJson: false, includeToJson: false) @override - final FailedState state; + int get hashCode => runtimeType.hashCode; + @override - final Object? reason; + String toString() { + return 'OutgoingState()'; + } +} + +/// @nodoc +class $OutgoingStateCopyWith<$Res> { + $OutgoingStateCopyWith(OutgoingState _, $Res Function(OutgoingState) __); +} + +/// @nodoc +@JsonSerializable() +class Sending implements OutgoingState { + const Sending({final String? $type}) : $type = $type ?? 'sending'; + factory Sending.fromJson(Map json) => + _$SendingFromJson(json); @JsonKey(name: 'runtimeType') final String $type; @override - String toString() { - return 'MessageState.failed(state: $state, reason: $reason)'; + Map toJson() { + return _$SendingToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$MessageFailedImpl && - (identical(other.state, state) || other.state == state) && - const DeepCollectionEquality().equals(other.reason, reason)); + (other.runtimeType == runtimeType && other is Sending); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, state, const DeepCollectionEquality().hash(reason)); - - /// Create a copy of MessageState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$MessageFailedImplCopyWith<_$MessageFailedImpl> get copyWith => - __$$MessageFailedImplCopyWithImpl<_$MessageFailedImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(OutgoingState state) outgoing, - required TResult Function(CompletedState state) completed, - required TResult Function(FailedState state, Object? reason) failed, - }) { - return failed(state, reason); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(OutgoingState state)? outgoing, - TResult? Function(CompletedState state)? completed, - TResult? Function(FailedState state, Object? reason)? failed, - }) { - return failed?.call(state, reason); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(OutgoingState state)? outgoing, - TResult Function(CompletedState state)? completed, - TResult Function(FailedState state, Object? reason)? failed, - required TResult orElse(), - }) { - if (failed != null) { - return failed(state, reason); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(MessageInitial value) initial, - required TResult Function(MessageOutgoing value) outgoing, - required TResult Function(MessageCompleted value) completed, - required TResult Function(MessageFailed value) failed, - }) { - return failed(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(MessageInitial value)? initial, - TResult? Function(MessageOutgoing value)? outgoing, - TResult? Function(MessageCompleted value)? completed, - TResult? Function(MessageFailed value)? failed, - }) { - return failed?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(MessageInitial value)? initial, - TResult Function(MessageOutgoing value)? outgoing, - TResult Function(MessageCompleted value)? completed, - TResult Function(MessageFailed value)? failed, - required TResult orElse(), - }) { - if (failed != null) { - return failed(this); - } - return orElse(); - } + int get hashCode => runtimeType.hashCode; @override - Map toJson() { - return _$$MessageFailedImplToJson( - this, - ); - } -} - -abstract class MessageFailed implements MessageState { - const factory MessageFailed( - {required final FailedState state, - final Object? reason}) = _$MessageFailedImpl; - - factory MessageFailed.fromJson(Map json) = - _$MessageFailedImpl.fromJson; - - FailedState get state; - Object? get reason; - - /// Create a copy of MessageState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$MessageFailedImplCopyWith<_$MessageFailedImpl> get copyWith => - throw _privateConstructorUsedError; -} - -OutgoingState _$OutgoingStateFromJson(Map json) { - switch (json['runtimeType']) { - case 'sending': - return Sending.fromJson(json); - case 'updating': - return Updating.fromJson(json); - case 'deleting': - return Deleting.fromJson(json); - - default: - throw CheckedFromJsonException(json, 'runtimeType', 'OutgoingState', - 'Invalid union type "${json['runtimeType']}"!'); + String toString() { + return 'OutgoingState.sending()'; } } -/// @nodoc -mixin _$OutgoingState { - @optionalTypeArgs - TResult when({ - required TResult Function() sending, - required TResult Function() updating, - required TResult Function(bool hard) deleting, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sending, - TResult? Function()? updating, - TResult? Function(bool hard)? deleting, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sending, - TResult Function()? updating, - TResult Function(bool hard)? deleting, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(Sending value) sending, - required TResult Function(Updating value) updating, - required TResult Function(Deleting value) deleting, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Sending value)? sending, - TResult? Function(Updating value)? updating, - TResult? Function(Deleting value)? deleting, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Sending value)? sending, - TResult Function(Updating value)? updating, - TResult Function(Deleting value)? deleting, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this OutgoingState to a JSON map. - Map toJson() => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $OutgoingStateCopyWith<$Res> { - factory $OutgoingStateCopyWith( - OutgoingState value, $Res Function(OutgoingState) then) = - _$OutgoingStateCopyWithImpl<$Res, OutgoingState>; -} - -/// @nodoc -class _$OutgoingStateCopyWithImpl<$Res, $Val extends OutgoingState> - implements $OutgoingStateCopyWith<$Res> { - _$OutgoingStateCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of OutgoingState - /// with the given fields replaced by the non-null parameter values. -} - -/// @nodoc -abstract class _$$SendingImplCopyWith<$Res> { - factory _$$SendingImplCopyWith( - _$SendingImpl value, $Res Function(_$SendingImpl) then) = - __$$SendingImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$SendingImplCopyWithImpl<$Res> - extends _$OutgoingStateCopyWithImpl<$Res, _$SendingImpl> - implements _$$SendingImplCopyWith<$Res> { - __$$SendingImplCopyWithImpl( - _$SendingImpl _value, $Res Function(_$SendingImpl) _then) - : super(_value, _then); - - /// Create a copy of OutgoingState - /// with the given fields replaced by the non-null parameter values. -} - /// @nodoc @JsonSerializable() -class _$SendingImpl implements Sending { - const _$SendingImpl({final String? $type}) : $type = $type ?? 'sending'; - - factory _$SendingImpl.fromJson(Map json) => - _$$SendingImplFromJson(json); +class Updating implements OutgoingState { + const Updating({final String? $type}) : $type = $type ?? 'updating'; + factory Updating.fromJson(Map json) => + _$UpdatingFromJson(json); @JsonKey(name: 'runtimeType') final String $type; - @override - String toString() { - return 'OutgoingState.sending()'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$SendingImpl); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => runtimeType.hashCode; - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() sending, - required TResult Function() updating, - required TResult Function(bool hard) deleting, - }) { - return sending(); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sending, - TResult? Function()? updating, - TResult? Function(bool hard)? deleting, - }) { - return sending?.call(); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sending, - TResult Function()? updating, - TResult Function(bool hard)? deleting, - required TResult orElse(), - }) { - if (sending != null) { - return sending(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Sending value) sending, - required TResult Function(Updating value) updating, - required TResult Function(Deleting value) deleting, - }) { - return sending(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Sending value)? sending, - TResult? Function(Updating value)? updating, - TResult? Function(Deleting value)? deleting, - }) { - return sending?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Sending value)? sending, - TResult Function(Updating value)? updating, - TResult Function(Deleting value)? deleting, - required TResult orElse(), - }) { - if (sending != null) { - return sending(this); - } - return orElse(); - } - @override Map toJson() { - return _$$SendingImplToJson( + return _$UpdatingToJson( this, ); } -} - -abstract class Sending implements OutgoingState { - const factory Sending() = _$SendingImpl; - - factory Sending.fromJson(Map json) = _$SendingImpl.fromJson; -} - -/// @nodoc -abstract class _$$UpdatingImplCopyWith<$Res> { - factory _$$UpdatingImplCopyWith( - _$UpdatingImpl value, $Res Function(_$UpdatingImpl) then) = - __$$UpdatingImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$UpdatingImplCopyWithImpl<$Res> - extends _$OutgoingStateCopyWithImpl<$Res, _$UpdatingImpl> - implements _$$UpdatingImplCopyWith<$Res> { - __$$UpdatingImplCopyWithImpl( - _$UpdatingImpl _value, $Res Function(_$UpdatingImpl) _then) - : super(_value, _then); - - /// Create a copy of OutgoingState - /// with the given fields replaced by the non-null parameter values. -} - -/// @nodoc -@JsonSerializable() -class _$UpdatingImpl implements Updating { - const _$UpdatingImpl({final String? $type}) : $type = $type ?? 'updating'; - - factory _$UpdatingImpl.fromJson(Map json) => - _$$UpdatingImplFromJson(json); - - @JsonKey(name: 'runtimeType') - final String $type; - - @override - String toString() { - return 'OutgoingState.updating()'; - } @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$UpdatingImpl); + (other.runtimeType == runtimeType && other is Updating); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -1064,884 +465,149 @@ class _$UpdatingImpl implements Updating { int get hashCode => runtimeType.hashCode; @override - @optionalTypeArgs - TResult when({ - required TResult Function() sending, - required TResult Function() updating, - required TResult Function(bool hard) deleting, - }) { - return updating(); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sending, - TResult? Function()? updating, - TResult? Function(bool hard)? deleting, - }) { - return updating?.call(); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sending, - TResult Function()? updating, - TResult Function(bool hard)? deleting, - required TResult orElse(), - }) { - if (updating != null) { - return updating(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Sending value) sending, - required TResult Function(Updating value) updating, - required TResult Function(Deleting value) deleting, - }) { - return updating(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Sending value)? sending, - TResult? Function(Updating value)? updating, - TResult? Function(Deleting value)? deleting, - }) { - return updating?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Sending value)? sending, - TResult Function(Updating value)? updating, - TResult Function(Deleting value)? deleting, - required TResult orElse(), - }) { - if (updating != null) { - return updating(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$UpdatingImplToJson( - this, - ); - } -} - -abstract class Updating implements OutgoingState { - const factory Updating() = _$UpdatingImpl; - - factory Updating.fromJson(Map json) = - _$UpdatingImpl.fromJson; -} - -/// @nodoc -abstract class _$$DeletingImplCopyWith<$Res> { - factory _$$DeletingImplCopyWith( - _$DeletingImpl value, $Res Function(_$DeletingImpl) then) = - __$$DeletingImplCopyWithImpl<$Res>; - @useResult - $Res call({bool hard}); -} - -/// @nodoc -class __$$DeletingImplCopyWithImpl<$Res> - extends _$OutgoingStateCopyWithImpl<$Res, _$DeletingImpl> - implements _$$DeletingImplCopyWith<$Res> { - __$$DeletingImplCopyWithImpl( - _$DeletingImpl _value, $Res Function(_$DeletingImpl) _then) - : super(_value, _then); - - /// Create a copy of OutgoingState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? hard = null, - }) { - return _then(_$DeletingImpl( - hard: null == hard - ? _value.hard - : hard // ignore: cast_nullable_to_non_nullable - as bool, - )); + String toString() { + return 'OutgoingState.updating()'; } } /// @nodoc @JsonSerializable() -class _$DeletingImpl implements Deleting { - const _$DeletingImpl({this.hard = false, final String? $type}) +class Deleting implements OutgoingState { + const Deleting({this.hard = false, final String? $type}) : $type = $type ?? 'deleting'; + factory Deleting.fromJson(Map json) => + _$DeletingFromJson(json); - factory _$DeletingImpl.fromJson(Map json) => - _$$DeletingImplFromJson(json); - - @override @JsonKey() final bool hard; @JsonKey(name: 'runtimeType') final String $type; - @override - String toString() { - return 'OutgoingState.deleting(hard: $hard)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$DeletingImpl && - (identical(other.hard, hard) || other.hard == hard)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, hard); - /// Create a copy of OutgoingState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) - @override @pragma('vm:prefer-inline') - _$$DeletingImplCopyWith<_$DeletingImpl> get copyWith => - __$$DeletingImplCopyWithImpl<_$DeletingImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() sending, - required TResult Function() updating, - required TResult Function(bool hard) deleting, - }) { - return deleting(hard); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sending, - TResult? Function()? updating, - TResult? Function(bool hard)? deleting, - }) { - return deleting?.call(hard); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sending, - TResult Function()? updating, - TResult Function(bool hard)? deleting, - required TResult orElse(), - }) { - if (deleting != null) { - return deleting(hard); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Sending value) sending, - required TResult Function(Updating value) updating, - required TResult Function(Deleting value) deleting, - }) { - return deleting(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Sending value)? sending, - TResult? Function(Updating value)? updating, - TResult? Function(Deleting value)? deleting, - }) { - return deleting?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Sending value)? sending, - TResult Function(Updating value)? updating, - TResult Function(Deleting value)? deleting, - required TResult orElse(), - }) { - if (deleting != null) { - return deleting(this); - } - return orElse(); - } + $DeletingCopyWith get copyWith => + _$DeletingCopyWithImpl(this, _$identity); @override Map toJson() { - return _$$DeletingImplToJson( + return _$DeletingToJson( this, ); } -} - -abstract class Deleting implements OutgoingState { - const factory Deleting({final bool hard}) = _$DeletingImpl; - - factory Deleting.fromJson(Map json) = - _$DeletingImpl.fromJson; - - bool get hard; - - /// Create a copy of OutgoingState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$DeletingImplCopyWith<_$DeletingImpl> get copyWith => - throw _privateConstructorUsedError; -} - -CompletedState _$CompletedStateFromJson(Map json) { - switch (json['runtimeType']) { - case 'sent': - return Sent.fromJson(json); - case 'updated': - return Updated.fromJson(json); - case 'deleted': - return Deleted.fromJson(json); - - default: - throw CheckedFromJsonException(json, 'runtimeType', 'CompletedState', - 'Invalid union type "${json['runtimeType']}"!'); - } -} - -/// @nodoc -mixin _$CompletedState { - @optionalTypeArgs - TResult when({ - required TResult Function() sent, - required TResult Function() updated, - required TResult Function(bool hard) deleted, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sent, - TResult? Function()? updated, - TResult? Function(bool hard)? deleted, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sent, - TResult Function()? updated, - TResult Function(bool hard)? deleted, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(Sent value) sent, - required TResult Function(Updated value) updated, - required TResult Function(Deleted value) deleted, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Sent value)? sent, - TResult? Function(Updated value)? updated, - TResult? Function(Deleted value)? deleted, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Sent value)? sent, - TResult Function(Updated value)? updated, - TResult Function(Deleted value)? deleted, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this CompletedState to a JSON map. - Map toJson() => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $CompletedStateCopyWith<$Res> { - factory $CompletedStateCopyWith( - CompletedState value, $Res Function(CompletedState) then) = - _$CompletedStateCopyWithImpl<$Res, CompletedState>; -} - -/// @nodoc -class _$CompletedStateCopyWithImpl<$Res, $Val extends CompletedState> - implements $CompletedStateCopyWith<$Res> { - _$CompletedStateCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of CompletedState - /// with the given fields replaced by the non-null parameter values. -} - -/// @nodoc -abstract class _$$SentImplCopyWith<$Res> { - factory _$$SentImplCopyWith( - _$SentImpl value, $Res Function(_$SentImpl) then) = - __$$SentImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$SentImplCopyWithImpl<$Res> - extends _$CompletedStateCopyWithImpl<$Res, _$SentImpl> - implements _$$SentImplCopyWith<$Res> { - __$$SentImplCopyWithImpl(_$SentImpl _value, $Res Function(_$SentImpl) _then) - : super(_value, _then); - - /// Create a copy of CompletedState - /// with the given fields replaced by the non-null parameter values. -} - -/// @nodoc -@JsonSerializable() -class _$SentImpl implements Sent { - const _$SentImpl({final String? $type}) : $type = $type ?? 'sent'; - - factory _$SentImpl.fromJson(Map json) => - _$$SentImplFromJson(json); - - @JsonKey(name: 'runtimeType') - final String $type; - - @override - String toString() { - return 'CompletedState.sent()'; - } @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$SentImpl); + (other.runtimeType == runtimeType && + other is Deleting && + (identical(other.hard, hard) || other.hard == hard)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => runtimeType.hashCode; - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() sent, - required TResult Function() updated, - required TResult Function(bool hard) deleted, - }) { - return sent(); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sent, - TResult? Function()? updated, - TResult? Function(bool hard)? deleted, - }) { - return sent?.call(); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sent, - TResult Function()? updated, - TResult Function(bool hard)? deleted, - required TResult orElse(), - }) { - if (sent != null) { - return sent(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Sent value) sent, - required TResult Function(Updated value) updated, - required TResult Function(Deleted value) deleted, - }) { - return sent(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Sent value)? sent, - TResult? Function(Updated value)? updated, - TResult? Function(Deleted value)? deleted, - }) { - return sent?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Sent value)? sent, - TResult Function(Updated value)? updated, - TResult Function(Deleted value)? deleted, - required TResult orElse(), - }) { - if (sent != null) { - return sent(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$SentImplToJson( - this, - ); - } -} - -abstract class Sent implements CompletedState { - const factory Sent() = _$SentImpl; - - factory Sent.fromJson(Map json) = _$SentImpl.fromJson; -} - -/// @nodoc -abstract class _$$UpdatedImplCopyWith<$Res> { - factory _$$UpdatedImplCopyWith( - _$UpdatedImpl value, $Res Function(_$UpdatedImpl) then) = - __$$UpdatedImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$UpdatedImplCopyWithImpl<$Res> - extends _$CompletedStateCopyWithImpl<$Res, _$UpdatedImpl> - implements _$$UpdatedImplCopyWith<$Res> { - __$$UpdatedImplCopyWithImpl( - _$UpdatedImpl _value, $Res Function(_$UpdatedImpl) _then) - : super(_value, _then); - - /// Create a copy of CompletedState - /// with the given fields replaced by the non-null parameter values. -} - -/// @nodoc -@JsonSerializable() -class _$UpdatedImpl implements Updated { - const _$UpdatedImpl({final String? $type}) : $type = $type ?? 'updated'; - - factory _$UpdatedImpl.fromJson(Map json) => - _$$UpdatedImplFromJson(json); - - @JsonKey(name: 'runtimeType') - final String $type; + int get hashCode => Object.hash(runtimeType, hard); @override String toString() { - return 'CompletedState.updated()'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$UpdatedImpl); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => runtimeType.hashCode; - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() sent, - required TResult Function() updated, - required TResult Function(bool hard) deleted, - }) { - return updated(); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sent, - TResult? Function()? updated, - TResult? Function(bool hard)? deleted, - }) { - return updated?.call(); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sent, - TResult Function()? updated, - TResult Function(bool hard)? deleted, - required TResult orElse(), - }) { - if (updated != null) { - return updated(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Sent value) sent, - required TResult Function(Updated value) updated, - required TResult Function(Deleted value) deleted, - }) { - return updated(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Sent value)? sent, - TResult? Function(Updated value)? updated, - TResult? Function(Deleted value)? deleted, - }) { - return updated?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Sent value)? sent, - TResult Function(Updated value)? updated, - TResult Function(Deleted value)? deleted, - required TResult orElse(), - }) { - if (updated != null) { - return updated(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$UpdatedImplToJson( - this, - ); + return 'OutgoingState.deleting(hard: $hard)'; } } -abstract class Updated implements CompletedState { - const factory Updated() = _$UpdatedImpl; - - factory Updated.fromJson(Map json) = _$UpdatedImpl.fromJson; -} - /// @nodoc -abstract class _$$DeletedImplCopyWith<$Res> { - factory _$$DeletedImplCopyWith( - _$DeletedImpl value, $Res Function(_$DeletedImpl) then) = - __$$DeletedImplCopyWithImpl<$Res>; +abstract mixin class $DeletingCopyWith<$Res> + implements $OutgoingStateCopyWith<$Res> { + factory $DeletingCopyWith(Deleting value, $Res Function(Deleting) _then) = + _$DeletingCopyWithImpl; @useResult $Res call({bool hard}); } /// @nodoc -class __$$DeletedImplCopyWithImpl<$Res> - extends _$CompletedStateCopyWithImpl<$Res, _$DeletedImpl> - implements _$$DeletedImplCopyWith<$Res> { - __$$DeletedImplCopyWithImpl( - _$DeletedImpl _value, $Res Function(_$DeletedImpl) _then) - : super(_value, _then); +class _$DeletingCopyWithImpl<$Res> implements $DeletingCopyWith<$Res> { + _$DeletingCopyWithImpl(this._self, this._then); - /// Create a copy of CompletedState + final Deleting _self; + final $Res Function(Deleting) _then; + + /// Create a copy of OutgoingState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') - @override $Res call({ Object? hard = null, }) { - return _then(_$DeletedImpl( + return _then(Deleting( hard: null == hard - ? _value.hard + ? _self.hard : hard // ignore: cast_nullable_to_non_nullable as bool, )); } } -/// @nodoc -@JsonSerializable() -class _$DeletedImpl implements Deleted { - const _$DeletedImpl({this.hard = false, final String? $type}) - : $type = $type ?? 'deleted'; - - factory _$DeletedImpl.fromJson(Map json) => - _$$DeletedImplFromJson(json); - - @override - @JsonKey() - final bool hard; - - @JsonKey(name: 'runtimeType') - final String $type; - - @override - String toString() { - return 'CompletedState.deleted(hard: $hard)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$DeletedImpl && - (identical(other.hard, hard) || other.hard == hard)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, hard); - - /// Create a copy of CompletedState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$DeletedImplCopyWith<_$DeletedImpl> get copyWith => - __$$DeletedImplCopyWithImpl<_$DeletedImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() sent, - required TResult Function() updated, - required TResult Function(bool hard) deleted, - }) { - return deleted(hard); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sent, - TResult? Function()? updated, - TResult? Function(bool hard)? deleted, - }) { - return deleted?.call(hard); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sent, - TResult Function()? updated, - TResult Function(bool hard)? deleted, - required TResult orElse(), - }) { - if (deleted != null) { - return deleted(hard); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(Sent value) sent, - required TResult Function(Updated value) updated, - required TResult Function(Deleted value) deleted, - }) { - return deleted(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(Sent value)? sent, - TResult? Function(Updated value)? updated, - TResult? Function(Deleted value)? deleted, - }) { - return deleted?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(Sent value)? sent, - TResult Function(Updated value)? updated, - TResult Function(Deleted value)? deleted, - required TResult orElse(), - }) { - if (deleted != null) { - return deleted(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$DeletedImplToJson( - this, - ); - } -} - -abstract class Deleted implements CompletedState { - const factory Deleted({final bool hard}) = _$DeletedImpl; - - factory Deleted.fromJson(Map json) = _$DeletedImpl.fromJson; - - bool get hard; - - /// Create a copy of CompletedState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$DeletedImplCopyWith<_$DeletedImpl> get copyWith => - throw _privateConstructorUsedError; -} - -FailedState _$FailedStateFromJson(Map json) { +CompletedState _$CompletedStateFromJson(Map json) { switch (json['runtimeType']) { - case 'sendingFailed': - return SendingFailed.fromJson(json); - case 'updatingFailed': - return UpdatingFailed.fromJson(json); - case 'deletingFailed': - return DeletingFailed.fromJson(json); - - default: - throw CheckedFromJsonException(json, 'runtimeType', 'FailedState', - 'Invalid union type "${json['runtimeType']}"!'); - } -} - -/// @nodoc -mixin _$FailedState { - @optionalTypeArgs - TResult when({ - required TResult Function() sendingFailed, - required TResult Function() updatingFailed, - required TResult Function(bool hard) deletingFailed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sendingFailed, - TResult? Function()? updatingFailed, - TResult? Function(bool hard)? deletingFailed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sendingFailed, - TResult Function()? updatingFailed, - TResult Function(bool hard)? deletingFailed, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(SendingFailed value) sendingFailed, - required TResult Function(UpdatingFailed value) updatingFailed, - required TResult Function(DeletingFailed value) deletingFailed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(SendingFailed value)? sendingFailed, - TResult? Function(UpdatingFailed value)? updatingFailed, - TResult? Function(DeletingFailed value)? deletingFailed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(SendingFailed value)? sendingFailed, - TResult Function(UpdatingFailed value)? updatingFailed, - TResult Function(DeletingFailed value)? deletingFailed, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - - /// Serializes this FailedState to a JSON map. - Map toJson() => throw _privateConstructorUsedError; -} + case 'sent': + return Sent.fromJson(json); + case 'updated': + return Updated.fromJson(json); + case 'deleted': + return Deleted.fromJson(json); -/// @nodoc -abstract class $FailedStateCopyWith<$Res> { - factory $FailedStateCopyWith( - FailedState value, $Res Function(FailedState) then) = - _$FailedStateCopyWithImpl<$Res, FailedState>; + default: + throw CheckedFromJsonException(json, 'runtimeType', 'CompletedState', + 'Invalid union type "${json['runtimeType']}"!'); + } } /// @nodoc -class _$FailedStateCopyWithImpl<$Res, $Val extends FailedState> - implements $FailedStateCopyWith<$Res> { - _$FailedStateCopyWithImpl(this._value, this._then); +mixin _$CompletedState { + /// Serializes this CompletedState to a JSON map. + Map toJson(); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is CompletedState); + } - /// Create a copy of FailedState - /// with the given fields replaced by the non-null parameter values. -} + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; -/// @nodoc -abstract class _$$SendingFailedImplCopyWith<$Res> { - factory _$$SendingFailedImplCopyWith( - _$SendingFailedImpl value, $Res Function(_$SendingFailedImpl) then) = - __$$SendingFailedImplCopyWithImpl<$Res>; + @override + String toString() { + return 'CompletedState()'; + } } /// @nodoc -class __$$SendingFailedImplCopyWithImpl<$Res> - extends _$FailedStateCopyWithImpl<$Res, _$SendingFailedImpl> - implements _$$SendingFailedImplCopyWith<$Res> { - __$$SendingFailedImplCopyWithImpl( - _$SendingFailedImpl _value, $Res Function(_$SendingFailedImpl) _then) - : super(_value, _then); - - /// Create a copy of FailedState - /// with the given fields replaced by the non-null parameter values. +class $CompletedStateCopyWith<$Res> { + $CompletedStateCopyWith(CompletedState _, $Res Function(CompletedState) __); } /// @nodoc @JsonSerializable() -class _$SendingFailedImpl implements SendingFailed { - const _$SendingFailedImpl({final String? $type}) - : $type = $type ?? 'sendingFailed'; - - factory _$SendingFailedImpl.fromJson(Map json) => - _$$SendingFailedImplFromJson(json); +class Sent implements CompletedState { + const Sent({final String? $type}) : $type = $type ?? 'sent'; + factory Sent.fromJson(Map json) => _$SentFromJson(json); @JsonKey(name: 'runtimeType') final String $type; @override - String toString() { - return 'FailedState.sendingFailed()'; + Map toJson() { + return _$SentToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$SendingFailedImpl); + (other.runtimeType == runtimeType && other is Sent); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -1949,128 +615,32 @@ class _$SendingFailedImpl implements SendingFailed { int get hashCode => runtimeType.hashCode; @override - @optionalTypeArgs - TResult when({ - required TResult Function() sendingFailed, - required TResult Function() updatingFailed, - required TResult Function(bool hard) deletingFailed, - }) { - return sendingFailed(); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sendingFailed, - TResult? Function()? updatingFailed, - TResult? Function(bool hard)? deletingFailed, - }) { - return sendingFailed?.call(); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sendingFailed, - TResult Function()? updatingFailed, - TResult Function(bool hard)? deletingFailed, - required TResult orElse(), - }) { - if (sendingFailed != null) { - return sendingFailed(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(SendingFailed value) sendingFailed, - required TResult Function(UpdatingFailed value) updatingFailed, - required TResult Function(DeletingFailed value) deletingFailed, - }) { - return sendingFailed(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(SendingFailed value)? sendingFailed, - TResult? Function(UpdatingFailed value)? updatingFailed, - TResult? Function(DeletingFailed value)? deletingFailed, - }) { - return sendingFailed?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(SendingFailed value)? sendingFailed, - TResult Function(UpdatingFailed value)? updatingFailed, - TResult Function(DeletingFailed value)? deletingFailed, - required TResult orElse(), - }) { - if (sendingFailed != null) { - return sendingFailed(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$SendingFailedImplToJson( - this, - ); + String toString() { + return 'CompletedState.sent()'; } } -abstract class SendingFailed implements FailedState { - const factory SendingFailed() = _$SendingFailedImpl; - - factory SendingFailed.fromJson(Map json) = - _$SendingFailedImpl.fromJson; -} - -/// @nodoc -abstract class _$$UpdatingFailedImplCopyWith<$Res> { - factory _$$UpdatingFailedImplCopyWith(_$UpdatingFailedImpl value, - $Res Function(_$UpdatingFailedImpl) then) = - __$$UpdatingFailedImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$UpdatingFailedImplCopyWithImpl<$Res> - extends _$FailedStateCopyWithImpl<$Res, _$UpdatingFailedImpl> - implements _$$UpdatingFailedImplCopyWith<$Res> { - __$$UpdatingFailedImplCopyWithImpl( - _$UpdatingFailedImpl _value, $Res Function(_$UpdatingFailedImpl) _then) - : super(_value, _then); - - /// Create a copy of FailedState - /// with the given fields replaced by the non-null parameter values. -} - /// @nodoc @JsonSerializable() -class _$UpdatingFailedImpl implements UpdatingFailed { - const _$UpdatingFailedImpl({final String? $type}) - : $type = $type ?? 'updatingFailed'; - - factory _$UpdatingFailedImpl.fromJson(Map json) => - _$$UpdatingFailedImplFromJson(json); +class Updated implements CompletedState { + const Updated({final String? $type}) : $type = $type ?? 'updated'; + factory Updated.fromJson(Map json) => + _$UpdatedFromJson(json); @JsonKey(name: 'runtimeType') final String $type; @override - String toString() { - return 'FailedState.updatingFailed()'; + Map toJson() { + return _$UpdatedToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$UpdatingFailedImpl); + (other.runtimeType == runtimeType && other is Updated); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -2078,250 +648,273 @@ class _$UpdatingFailedImpl implements UpdatingFailed { int get hashCode => runtimeType.hashCode; @override - @optionalTypeArgs - TResult when({ - required TResult Function() sendingFailed, - required TResult Function() updatingFailed, - required TResult Function(bool hard) deletingFailed, - }) { - return updatingFailed(); + String toString() { + return 'CompletedState.updated()'; } +} - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sendingFailed, - TResult? Function()? updatingFailed, - TResult? Function(bool hard)? deletingFailed, - }) { - return updatingFailed?.call(); - } +/// @nodoc +@JsonSerializable() +class Deleted implements CompletedState { + const Deleted({this.hard = false, final String? $type}) + : $type = $type ?? 'deleted'; + factory Deleted.fromJson(Map json) => + _$DeletedFromJson(json); - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sendingFailed, - TResult Function()? updatingFailed, - TResult Function(bool hard)? deletingFailed, - required TResult orElse(), - }) { - if (updatingFailed != null) { - return updatingFailed(); - } - return orElse(); - } + @JsonKey() + final bool hard; + + @JsonKey(name: 'runtimeType') + final String $type; + + /// Create a copy of CompletedState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeletedCopyWith get copyWith => + _$DeletedCopyWithImpl(this, _$identity); @override - @optionalTypeArgs - TResult map({ - required TResult Function(SendingFailed value) sendingFailed, - required TResult Function(UpdatingFailed value) updatingFailed, - required TResult Function(DeletingFailed value) deletingFailed, - }) { - return updatingFailed(this); + Map toJson() { + return _$DeletedToJson( + this, + ); } @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(SendingFailed value)? sendingFailed, - TResult? Function(UpdatingFailed value)? updatingFailed, - TResult? Function(DeletingFailed value)? deletingFailed, - }) { - return updatingFailed?.call(this); + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Deleted && + (identical(other.hard, hard) || other.hard == hard)); } + @JsonKey(includeFromJson: false, includeToJson: false) @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(SendingFailed value)? sendingFailed, - TResult Function(UpdatingFailed value)? updatingFailed, - TResult Function(DeletingFailed value)? deletingFailed, - required TResult orElse(), - }) { - if (updatingFailed != null) { - return updatingFailed(this); - } - return orElse(); - } + int get hashCode => Object.hash(runtimeType, hard); @override - Map toJson() { - return _$$UpdatingFailedImplToJson( - this, - ); + String toString() { + return 'CompletedState.deleted(hard: $hard)'; } } -abstract class UpdatingFailed implements FailedState { - const factory UpdatingFailed() = _$UpdatingFailedImpl; - - factory UpdatingFailed.fromJson(Map json) = - _$UpdatingFailedImpl.fromJson; -} - /// @nodoc -abstract class _$$DeletingFailedImplCopyWith<$Res> { - factory _$$DeletingFailedImplCopyWith(_$DeletingFailedImpl value, - $Res Function(_$DeletingFailedImpl) then) = - __$$DeletingFailedImplCopyWithImpl<$Res>; +abstract mixin class $DeletedCopyWith<$Res> + implements $CompletedStateCopyWith<$Res> { + factory $DeletedCopyWith(Deleted value, $Res Function(Deleted) _then) = + _$DeletedCopyWithImpl; @useResult $Res call({bool hard}); } /// @nodoc -class __$$DeletingFailedImplCopyWithImpl<$Res> - extends _$FailedStateCopyWithImpl<$Res, _$DeletingFailedImpl> - implements _$$DeletingFailedImplCopyWith<$Res> { - __$$DeletingFailedImplCopyWithImpl( - _$DeletingFailedImpl _value, $Res Function(_$DeletingFailedImpl) _then) - : super(_value, _then); +class _$DeletedCopyWithImpl<$Res> implements $DeletedCopyWith<$Res> { + _$DeletedCopyWithImpl(this._self, this._then); - /// Create a copy of FailedState + final Deleted _self; + final $Res Function(Deleted) _then; + + /// Create a copy of CompletedState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') - @override $Res call({ Object? hard = null, }) { - return _then(_$DeletingFailedImpl( + return _then(Deleted( hard: null == hard - ? _value.hard + ? _self.hard : hard // ignore: cast_nullable_to_non_nullable as bool, )); } } +FailedState _$FailedStateFromJson(Map json) { + switch (json['runtimeType']) { + case 'sendingFailed': + return SendingFailed.fromJson(json); + case 'updatingFailed': + return UpdatingFailed.fromJson(json); + case 'deletingFailed': + return DeletingFailed.fromJson(json); + + default: + throw CheckedFromJsonException(json, 'runtimeType', 'FailedState', + 'Invalid union type "${json['runtimeType']}"!'); + } +} + /// @nodoc -@JsonSerializable() -class _$DeletingFailedImpl implements DeletingFailed { - const _$DeletingFailedImpl({this.hard = false, final String? $type}) - : $type = $type ?? 'deletingFailed'; +mixin _$FailedState { + /// Serializes this FailedState to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is FailedState); + } - factory _$DeletingFailedImpl.fromJson(Map json) => - _$$DeletingFailedImplFromJson(json); + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => runtimeType.hashCode; @override - @JsonKey() - final bool hard; + String toString() { + return 'FailedState()'; + } +} + +/// @nodoc +class $FailedStateCopyWith<$Res> { + $FailedStateCopyWith(FailedState _, $Res Function(FailedState) __); +} + +/// @nodoc +@JsonSerializable() +class SendingFailed implements FailedState { + const SendingFailed({final String? $type}) : $type = $type ?? 'sendingFailed'; + factory SendingFailed.fromJson(Map json) => + _$SendingFailedFromJson(json); @JsonKey(name: 'runtimeType') final String $type; @override - String toString() { - return 'FailedState.deletingFailed(hard: $hard)'; + Map toJson() { + return _$SendingFailedToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$DeletingFailedImpl && - (identical(other.hard, hard) || other.hard == hard)); + (other.runtimeType == runtimeType && other is SendingFailed); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash(runtimeType, hard); + int get hashCode => runtimeType.hashCode; - /// Create a copy of FailedState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) @override - @pragma('vm:prefer-inline') - _$$DeletingFailedImplCopyWith<_$DeletingFailedImpl> get copyWith => - __$$DeletingFailedImplCopyWithImpl<_$DeletingFailedImpl>( - this, _$identity); + String toString() { + return 'FailedState.sendingFailed()'; + } +} + +/// @nodoc +@JsonSerializable() +class UpdatingFailed implements FailedState { + const UpdatingFailed({final String? $type}) + : $type = $type ?? 'updatingFailed'; + factory UpdatingFailed.fromJson(Map json) => + _$UpdatingFailedFromJson(json); + + @JsonKey(name: 'runtimeType') + final String $type; @override - @optionalTypeArgs - TResult when({ - required TResult Function() sendingFailed, - required TResult Function() updatingFailed, - required TResult Function(bool hard) deletingFailed, - }) { - return deletingFailed(hard); + Map toJson() { + return _$UpdatingFailedToJson( + this, + ); } @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? sendingFailed, - TResult? Function()? updatingFailed, - TResult? Function(bool hard)? deletingFailed, - }) { - return deletingFailed?.call(hard); + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is UpdatingFailed); } + @JsonKey(includeFromJson: false, includeToJson: false) @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? sendingFailed, - TResult Function()? updatingFailed, - TResult Function(bool hard)? deletingFailed, - required TResult orElse(), - }) { - if (deletingFailed != null) { - return deletingFailed(hard); - } - return orElse(); - } + int get hashCode => runtimeType.hashCode; @override - @optionalTypeArgs - TResult map({ - required TResult Function(SendingFailed value) sendingFailed, - required TResult Function(UpdatingFailed value) updatingFailed, - required TResult Function(DeletingFailed value) deletingFailed, - }) { - return deletingFailed(this); + String toString() { + return 'FailedState.updatingFailed()'; } +} + +/// @nodoc +@JsonSerializable() +class DeletingFailed implements FailedState { + const DeletingFailed({this.hard = false, final String? $type}) + : $type = $type ?? 'deletingFailed'; + factory DeletingFailed.fromJson(Map json) => + _$DeletingFailedFromJson(json); + + @JsonKey() + final bool hard; + + @JsonKey(name: 'runtimeType') + final String $type; + + /// Create a copy of FailedState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $DeletingFailedCopyWith get copyWith => + _$DeletingFailedCopyWithImpl(this, _$identity); @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(SendingFailed value)? sendingFailed, - TResult? Function(UpdatingFailed value)? updatingFailed, - TResult? Function(DeletingFailed value)? deletingFailed, - }) { - return deletingFailed?.call(this); + Map toJson() { + return _$DeletingFailedToJson( + this, + ); } @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(SendingFailed value)? sendingFailed, - TResult Function(UpdatingFailed value)? updatingFailed, - TResult Function(DeletingFailed value)? deletingFailed, - required TResult orElse(), - }) { - if (deletingFailed != null) { - return deletingFailed(this); - } - return orElse(); + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is DeletingFailed && + (identical(other.hard, hard) || other.hard == hard)); } + @JsonKey(includeFromJson: false, includeToJson: false) @override - Map toJson() { - return _$$DeletingFailedImplToJson( - this, - ); + int get hashCode => Object.hash(runtimeType, hard); + + @override + String toString() { + return 'FailedState.deletingFailed(hard: $hard)'; } } -abstract class DeletingFailed implements FailedState { - const factory DeletingFailed({final bool hard}) = _$DeletingFailedImpl; +/// @nodoc +abstract mixin class $DeletingFailedCopyWith<$Res> + implements $FailedStateCopyWith<$Res> { + factory $DeletingFailedCopyWith( + DeletingFailed value, $Res Function(DeletingFailed) _then) = + _$DeletingFailedCopyWithImpl; + @useResult + $Res call({bool hard}); +} - factory DeletingFailed.fromJson(Map json) = - _$DeletingFailedImpl.fromJson; +/// @nodoc +class _$DeletingFailedCopyWithImpl<$Res> + implements $DeletingFailedCopyWith<$Res> { + _$DeletingFailedCopyWithImpl(this._self, this._then); - bool get hard; + final DeletingFailed _self; + final $Res Function(DeletingFailed) _then; /// Create a copy of FailedState /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$DeletingFailedImplCopyWith<_$DeletingFailedImpl> get copyWith => - throw _privateConstructorUsedError; + @pragma('vm:prefer-inline') + $Res call({ + Object? hard = null, + }) { + return _then(DeletingFailed( + hard: null == hard + ? _self.hard + : hard // ignore: cast_nullable_to_non_nullable + as bool, + )); + } } + +// dart format on diff --git a/packages/stream_chat/lib/src/core/models/message_state.g.dart b/packages/stream_chat/lib/src/core/models/message_state.g.dart index 7cf2531c89..e39b40667b 100644 --- a/packages/stream_chat/lib/src/core/models/message_state.g.dart +++ b/packages/stream_chat/lib/src/core/models/message_state.g.dart @@ -6,151 +6,133 @@ part of 'message_state.dart'; // JsonSerializableGenerator // ************************************************************************** -_$MessageInitialImpl _$$MessageInitialImplFromJson(Map json) => - _$MessageInitialImpl( +MessageInitial _$MessageInitialFromJson(Map json) => + MessageInitial( $type: json['runtimeType'] as String?, ); -Map _$$MessageInitialImplToJson( - _$MessageInitialImpl instance) => +Map _$MessageInitialToJson(MessageInitial instance) => { 'runtimeType': instance.$type, }; -_$MessageOutgoingImpl _$$MessageOutgoingImplFromJson( - Map json) => - _$MessageOutgoingImpl( +MessageOutgoing _$MessageOutgoingFromJson(Map json) => + MessageOutgoing( state: OutgoingState.fromJson(json['state'] as Map), $type: json['runtimeType'] as String?, ); -Map _$$MessageOutgoingImplToJson( - _$MessageOutgoingImpl instance) => +Map _$MessageOutgoingToJson(MessageOutgoing instance) => { 'state': instance.state.toJson(), 'runtimeType': instance.$type, }; -_$MessageCompletedImpl _$$MessageCompletedImplFromJson( - Map json) => - _$MessageCompletedImpl( +MessageCompleted _$MessageCompletedFromJson(Map json) => + MessageCompleted( state: CompletedState.fromJson(json['state'] as Map), $type: json['runtimeType'] as String?, ); -Map _$$MessageCompletedImplToJson( - _$MessageCompletedImpl instance) => +Map _$MessageCompletedToJson(MessageCompleted instance) => { 'state': instance.state.toJson(), 'runtimeType': instance.$type, }; -_$MessageFailedImpl _$$MessageFailedImplFromJson(Map json) => - _$MessageFailedImpl( +MessageFailed _$MessageFailedFromJson(Map json) => + MessageFailed( state: FailedState.fromJson(json['state'] as Map), reason: json['reason'], $type: json['runtimeType'] as String?, ); -Map _$$MessageFailedImplToJson(_$MessageFailedImpl instance) => +Map _$MessageFailedToJson(MessageFailed instance) => { 'state': instance.state.toJson(), 'reason': instance.reason, 'runtimeType': instance.$type, }; -_$SendingImpl _$$SendingImplFromJson(Map json) => - _$SendingImpl( +Sending _$SendingFromJson(Map json) => Sending( $type: json['runtimeType'] as String?, ); -Map _$$SendingImplToJson(_$SendingImpl instance) => - { +Map _$SendingToJson(Sending instance) => { 'runtimeType': instance.$type, }; -_$UpdatingImpl _$$UpdatingImplFromJson(Map json) => - _$UpdatingImpl( +Updating _$UpdatingFromJson(Map json) => Updating( $type: json['runtimeType'] as String?, ); -Map _$$UpdatingImplToJson(_$UpdatingImpl instance) => - { +Map _$UpdatingToJson(Updating instance) => { 'runtimeType': instance.$type, }; -_$DeletingImpl _$$DeletingImplFromJson(Map json) => - _$DeletingImpl( +Deleting _$DeletingFromJson(Map json) => Deleting( hard: json['hard'] as bool? ?? false, $type: json['runtimeType'] as String?, ); -Map _$$DeletingImplToJson(_$DeletingImpl instance) => - { +Map _$DeletingToJson(Deleting instance) => { 'hard': instance.hard, 'runtimeType': instance.$type, }; -_$SentImpl _$$SentImplFromJson(Map json) => _$SentImpl( +Sent _$SentFromJson(Map json) => Sent( $type: json['runtimeType'] as String?, ); -Map _$$SentImplToJson(_$SentImpl instance) => - { +Map _$SentToJson(Sent instance) => { 'runtimeType': instance.$type, }; -_$UpdatedImpl _$$UpdatedImplFromJson(Map json) => - _$UpdatedImpl( +Updated _$UpdatedFromJson(Map json) => Updated( $type: json['runtimeType'] as String?, ); -Map _$$UpdatedImplToJson(_$UpdatedImpl instance) => - { +Map _$UpdatedToJson(Updated instance) => { 'runtimeType': instance.$type, }; -_$DeletedImpl _$$DeletedImplFromJson(Map json) => - _$DeletedImpl( +Deleted _$DeletedFromJson(Map json) => Deleted( hard: json['hard'] as bool? ?? false, $type: json['runtimeType'] as String?, ); -Map _$$DeletedImplToJson(_$DeletedImpl instance) => - { +Map _$DeletedToJson(Deleted instance) => { 'hard': instance.hard, 'runtimeType': instance.$type, }; -_$SendingFailedImpl _$$SendingFailedImplFromJson(Map json) => - _$SendingFailedImpl( +SendingFailed _$SendingFailedFromJson(Map json) => + SendingFailed( $type: json['runtimeType'] as String?, ); -Map _$$SendingFailedImplToJson(_$SendingFailedImpl instance) => +Map _$SendingFailedToJson(SendingFailed instance) => { 'runtimeType': instance.$type, }; -_$UpdatingFailedImpl _$$UpdatingFailedImplFromJson(Map json) => - _$UpdatingFailedImpl( +UpdatingFailed _$UpdatingFailedFromJson(Map json) => + UpdatingFailed( $type: json['runtimeType'] as String?, ); -Map _$$UpdatingFailedImplToJson( - _$UpdatingFailedImpl instance) => +Map _$UpdatingFailedToJson(UpdatingFailed instance) => { 'runtimeType': instance.$type, }; -_$DeletingFailedImpl _$$DeletingFailedImplFromJson(Map json) => - _$DeletingFailedImpl( +DeletingFailed _$DeletingFailedFromJson(Map json) => + DeletingFailed( hard: json['hard'] as bool? ?? false, $type: json['runtimeType'] as String?, ); -Map _$$DeletingFailedImplToJson( - _$DeletingFailedImpl instance) => +Map _$DeletingFailedToJson(DeletingFailed instance) => { 'hard': instance.hard, 'runtimeType': instance.$type, diff --git a/packages/stream_chat/lib/src/core/models/poll_voting_mode.dart b/packages/stream_chat/lib/src/core/models/poll_voting_mode.dart index f249ed342e..9be03c10bc 100644 --- a/packages/stream_chat/lib/src/core/models/poll_voting_mode.dart +++ b/packages/stream_chat/lib/src/core/models/poll_voting_mode.dart @@ -40,3 +40,118 @@ extension PollVotingModeX on Poll { return const VotingAll(); } } + +// coverage:ignore-start + +/// @nodoc +extension PollVotingModePatternMatching on PollVotingMode { + /// @nodoc + @optionalTypeArgs + TResult when({ + required TResult Function() disabled, + required TResult Function() unique, + required TResult Function(int count) limited, + required TResult Function() all, + }) { + final votingMode = this; + return switch (votingMode) { + VotingDisabled() => disabled(), + VotingUnique() => unique(), + VotingLimited() => limited(votingMode.count), + VotingAll() => all(), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? disabled, + TResult? Function()? unique, + TResult? Function(int count)? limited, + TResult? Function()? all, + }) { + final votingMode = this; + return switch (votingMode) { + VotingDisabled() => disabled?.call(), + VotingUnique() => unique?.call(), + VotingLimited() => limited?.call(votingMode.count), + VotingAll() => all?.call(), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? disabled, + TResult Function()? unique, + TResult Function(int count)? limited, + TResult Function()? all, + required TResult orElse(), + }) { + final votingMode = this; + final result = switch (votingMode) { + VotingDisabled() => disabled?.call(), + VotingUnique() => unique?.call(), + VotingLimited() => limited?.call(votingMode.count), + VotingAll() => all?.call(), + }; + + return result ?? orElse(); + } + + /// @nodoc + @optionalTypeArgs + TResult map({ + required TResult Function(VotingDisabled value) disabled, + required TResult Function(VotingUnique value) unique, + required TResult Function(VotingLimited value) limited, + required TResult Function(VotingAll value) all, + }) { + final votingMode = this; + return switch (votingMode) { + VotingDisabled() => disabled(votingMode), + VotingUnique() => unique(votingMode), + VotingLimited() => limited(votingMode), + VotingAll() => all(votingMode), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(VotingDisabled value)? disabled, + TResult? Function(VotingUnique value)? unique, + TResult? Function(VotingLimited value)? limited, + TResult? Function(VotingAll value)? all, + }) { + final votingMode = this; + return switch (votingMode) { + VotingDisabled() => disabled?.call(votingMode), + VotingUnique() => unique?.call(votingMode), + VotingLimited() => limited?.call(votingMode), + VotingAll() => all?.call(votingMode), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeMap({ + TResult Function(VotingDisabled value)? disabled, + TResult Function(VotingUnique value)? unique, + TResult Function(VotingLimited value)? limited, + TResult Function(VotingAll value)? all, + required TResult orElse(), + }) { + final votingMode = this; + final result = switch (votingMode) { + VotingDisabled() => disabled?.call(votingMode), + VotingUnique() => unique?.call(votingMode), + VotingLimited() => limited?.call(votingMode), + VotingAll() => all?.call(votingMode), + }; + + return result ?? orElse(); + } +} + +// coverage:ignore-end \ No newline at end of file diff --git a/packages/stream_chat/lib/src/core/models/poll_voting_mode.freezed.dart b/packages/stream_chat/lib/src/core/models/poll_voting_mode.freezed.dart index 1545f113aa..7353088c2a 100644 --- a/packages/stream_chat/lib/src/core/models/poll_voting_mode.freezed.dart +++ b/packages/stream_chat/lib/src/core/models/poll_voting_mode.freezed.dart @@ -1,3 +1,4 @@ +// dart format width=80 // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint @@ -9,585 +10,153 @@ part of 'poll_voting_mode.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - /// @nodoc mixin _$PollVotingMode { - @optionalTypeArgs - TResult when({ - required TResult Function() disabled, - required TResult Function() unique, - required TResult Function(int count) limited, - required TResult Function() all, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? disabled, - TResult? Function()? unique, - TResult? Function(int count)? limited, - TResult? Function()? all, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? disabled, - TResult Function()? unique, - TResult Function(int count)? limited, - TResult Function()? all, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(VotingDisabled value) disabled, - required TResult Function(VotingUnique value) unique, - required TResult Function(VotingLimited value) limited, - required TResult Function(VotingAll value) all, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(VotingDisabled value)? disabled, - TResult? Function(VotingUnique value)? unique, - TResult? Function(VotingLimited value)? limited, - TResult? Function(VotingAll value)? all, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(VotingDisabled value)? disabled, - TResult Function(VotingUnique value)? unique, - TResult Function(VotingLimited value)? limited, - TResult Function(VotingAll value)? all, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PollVotingModeCopyWith<$Res> { - factory $PollVotingModeCopyWith( - PollVotingMode value, $Res Function(PollVotingMode) then) = - _$PollVotingModeCopyWithImpl<$Res, PollVotingMode>; -} - -/// @nodoc -class _$PollVotingModeCopyWithImpl<$Res, $Val extends PollVotingMode> - implements $PollVotingModeCopyWith<$Res> { - _$PollVotingModeCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of PollVotingMode - /// with the given fields replaced by the non-null parameter values. -} - -/// @nodoc -abstract class _$$VotingDisabledImplCopyWith<$Res> { - factory _$$VotingDisabledImplCopyWith(_$VotingDisabledImpl value, - $Res Function(_$VotingDisabledImpl) then) = - __$$VotingDisabledImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$VotingDisabledImplCopyWithImpl<$Res> - extends _$PollVotingModeCopyWithImpl<$Res, _$VotingDisabledImpl> - implements _$$VotingDisabledImplCopyWith<$Res> { - __$$VotingDisabledImplCopyWithImpl( - _$VotingDisabledImpl _value, $Res Function(_$VotingDisabledImpl) _then) - : super(_value, _then); - - /// Create a copy of PollVotingMode - /// with the given fields replaced by the non-null parameter values. -} - -/// @nodoc - -class _$VotingDisabledImpl implements VotingDisabled { - const _$VotingDisabledImpl(); - - @override - String toString() { - return 'PollVotingMode.disabled()'; - } - @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$VotingDisabledImpl); + (other.runtimeType == runtimeType && other is PollVotingMode); } @override int get hashCode => runtimeType.hashCode; @override - @optionalTypeArgs - TResult when({ - required TResult Function() disabled, - required TResult Function() unique, - required TResult Function(int count) limited, - required TResult Function() all, - }) { - return disabled(); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? disabled, - TResult? Function()? unique, - TResult? Function(int count)? limited, - TResult? Function()? all, - }) { - return disabled?.call(); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? disabled, - TResult Function()? unique, - TResult Function(int count)? limited, - TResult Function()? all, - required TResult orElse(), - }) { - if (disabled != null) { - return disabled(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(VotingDisabled value) disabled, - required TResult Function(VotingUnique value) unique, - required TResult Function(VotingLimited value) limited, - required TResult Function(VotingAll value) all, - }) { - return disabled(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(VotingDisabled value)? disabled, - TResult? Function(VotingUnique value)? unique, - TResult? Function(VotingLimited value)? limited, - TResult? Function(VotingAll value)? all, - }) { - return disabled?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(VotingDisabled value)? disabled, - TResult Function(VotingUnique value)? unique, - TResult Function(VotingLimited value)? limited, - TResult Function(VotingAll value)? all, - required TResult orElse(), - }) { - if (disabled != null) { - return disabled(this); - } - return orElse(); + String toString() { + return 'PollVotingMode()'; } } -abstract class VotingDisabled implements PollVotingMode { - const factory VotingDisabled() = _$VotingDisabledImpl; -} - /// @nodoc -abstract class _$$VotingUniqueImplCopyWith<$Res> { - factory _$$VotingUniqueImplCopyWith( - _$VotingUniqueImpl value, $Res Function(_$VotingUniqueImpl) then) = - __$$VotingUniqueImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$VotingUniqueImplCopyWithImpl<$Res> - extends _$PollVotingModeCopyWithImpl<$Res, _$VotingUniqueImpl> - implements _$$VotingUniqueImplCopyWith<$Res> { - __$$VotingUniqueImplCopyWithImpl( - _$VotingUniqueImpl _value, $Res Function(_$VotingUniqueImpl) _then) - : super(_value, _then); - - /// Create a copy of PollVotingMode - /// with the given fields replaced by the non-null parameter values. +class $PollVotingModeCopyWith<$Res> { + $PollVotingModeCopyWith(PollVotingMode _, $Res Function(PollVotingMode) __); } /// @nodoc -class _$VotingUniqueImpl implements VotingUnique { - const _$VotingUniqueImpl(); - - @override - String toString() { - return 'PollVotingMode.unique()'; - } +class VotingDisabled implements PollVotingMode { + const VotingDisabled(); @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$VotingUniqueImpl); + (other.runtimeType == runtimeType && other is VotingDisabled); } @override int get hashCode => runtimeType.hashCode; @override - @optionalTypeArgs - TResult when({ - required TResult Function() disabled, - required TResult Function() unique, - required TResult Function(int count) limited, - required TResult Function() all, - }) { - return unique(); + String toString() { + return 'PollVotingMode.disabled()'; } +} - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? disabled, - TResult? Function()? unique, - TResult? Function(int count)? limited, - TResult? Function()? all, - }) { - return unique?.call(); - } +/// @nodoc - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? disabled, - TResult Function()? unique, - TResult Function(int count)? limited, - TResult Function()? all, - required TResult orElse(), - }) { - if (unique != null) { - return unique(); - } - return orElse(); - } +class VotingUnique implements PollVotingMode { + const VotingUnique(); @override - @optionalTypeArgs - TResult map({ - required TResult Function(VotingDisabled value) disabled, - required TResult Function(VotingUnique value) unique, - required TResult Function(VotingLimited value) limited, - required TResult Function(VotingAll value) all, - }) { - return unique(this); + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is VotingUnique); } @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(VotingDisabled value)? disabled, - TResult? Function(VotingUnique value)? unique, - TResult? Function(VotingLimited value)? limited, - TResult? Function(VotingAll value)? all, - }) { - return unique?.call(this); - } + int get hashCode => runtimeType.hashCode; @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(VotingDisabled value)? disabled, - TResult Function(VotingUnique value)? unique, - TResult Function(VotingLimited value)? limited, - TResult Function(VotingAll value)? all, - required TResult orElse(), - }) { - if (unique != null) { - return unique(this); - } - return orElse(); + String toString() { + return 'PollVotingMode.unique()'; } } -abstract class VotingUnique implements PollVotingMode { - const factory VotingUnique() = _$VotingUniqueImpl; -} - /// @nodoc -abstract class _$$VotingLimitedImplCopyWith<$Res> { - factory _$$VotingLimitedImplCopyWith( - _$VotingLimitedImpl value, $Res Function(_$VotingLimitedImpl) then) = - __$$VotingLimitedImplCopyWithImpl<$Res>; - @useResult - $Res call({int count}); -} -/// @nodoc -class __$$VotingLimitedImplCopyWithImpl<$Res> - extends _$PollVotingModeCopyWithImpl<$Res, _$VotingLimitedImpl> - implements _$$VotingLimitedImplCopyWith<$Res> { - __$$VotingLimitedImplCopyWithImpl( - _$VotingLimitedImpl _value, $Res Function(_$VotingLimitedImpl) _then) - : super(_value, _then); +class VotingLimited implements PollVotingMode { + const VotingLimited({required this.count}); + + final int count; /// Create a copy of PollVotingMode /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') - @override - $Res call({ - Object? count = null, - }) { - return _then(_$VotingLimitedImpl( - count: null == count - ? _value.count - : count // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// @nodoc - -class _$VotingLimitedImpl implements VotingLimited { - const _$VotingLimitedImpl({required this.count}); - - @override - final int count; - - @override - String toString() { - return 'PollVotingMode.limited(count: $count)'; - } + $VotingLimitedCopyWith get copyWith => + _$VotingLimitedCopyWithImpl(this, _$identity); @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$VotingLimitedImpl && + other is VotingLimited && (identical(other.count, count) || other.count == count)); } @override int get hashCode => Object.hash(runtimeType, count); - /// Create a copy of PollVotingMode - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$VotingLimitedImplCopyWith<_$VotingLimitedImpl> get copyWith => - __$$VotingLimitedImplCopyWithImpl<_$VotingLimitedImpl>(this, _$identity); - @override - @optionalTypeArgs - TResult when({ - required TResult Function() disabled, - required TResult Function() unique, - required TResult Function(int count) limited, - required TResult Function() all, - }) { - return limited(count); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? disabled, - TResult? Function()? unique, - TResult? Function(int count)? limited, - TResult? Function()? all, - }) { - return limited?.call(count); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? disabled, - TResult Function()? unique, - TResult Function(int count)? limited, - TResult Function()? all, - required TResult orElse(), - }) { - if (limited != null) { - return limited(count); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(VotingDisabled value) disabled, - required TResult Function(VotingUnique value) unique, - required TResult Function(VotingLimited value) limited, - required TResult Function(VotingAll value) all, - }) { - return limited(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(VotingDisabled value)? disabled, - TResult? Function(VotingUnique value)? unique, - TResult? Function(VotingLimited value)? limited, - TResult? Function(VotingAll value)? all, - }) { - return limited?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(VotingDisabled value)? disabled, - TResult Function(VotingUnique value)? unique, - TResult Function(VotingLimited value)? limited, - TResult Function(VotingAll value)? all, - required TResult orElse(), - }) { - if (limited != null) { - return limited(this); - } - return orElse(); + String toString() { + return 'PollVotingMode.limited(count: $count)'; } } -abstract class VotingLimited implements PollVotingMode { - const factory VotingLimited({required final int count}) = _$VotingLimitedImpl; - - int get count; - - /// Create a copy of PollVotingMode - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$VotingLimitedImplCopyWith<_$VotingLimitedImpl> get copyWith => - throw _privateConstructorUsedError; -} - /// @nodoc -abstract class _$$VotingAllImplCopyWith<$Res> { - factory _$$VotingAllImplCopyWith( - _$VotingAllImpl value, $Res Function(_$VotingAllImpl) then) = - __$$VotingAllImplCopyWithImpl<$Res>; +abstract mixin class $VotingLimitedCopyWith<$Res> + implements $PollVotingModeCopyWith<$Res> { + factory $VotingLimitedCopyWith( + VotingLimited value, $Res Function(VotingLimited) _then) = + _$VotingLimitedCopyWithImpl; + @useResult + $Res call({int count}); } /// @nodoc -class __$$VotingAllImplCopyWithImpl<$Res> - extends _$PollVotingModeCopyWithImpl<$Res, _$VotingAllImpl> - implements _$$VotingAllImplCopyWith<$Res> { - __$$VotingAllImplCopyWithImpl( - _$VotingAllImpl _value, $Res Function(_$VotingAllImpl) _then) - : super(_value, _then); +class _$VotingLimitedCopyWithImpl<$Res> + implements $VotingLimitedCopyWith<$Res> { + _$VotingLimitedCopyWithImpl(this._self, this._then); + + final VotingLimited _self; + final $Res Function(VotingLimited) _then; /// Create a copy of PollVotingMode /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({ + Object? count = null, + }) { + return _then(VotingLimited( + count: null == count + ? _self.count + : count // ignore: cast_nullable_to_non_nullable + as int, + )); + } } /// @nodoc -class _$VotingAllImpl implements VotingAll { - const _$VotingAllImpl(); - - @override - String toString() { - return 'PollVotingMode.all()'; - } +class VotingAll implements PollVotingMode { + const VotingAll(); @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && other is _$VotingAllImpl); + (other.runtimeType == runtimeType && other is VotingAll); } @override int get hashCode => runtimeType.hashCode; @override - @optionalTypeArgs - TResult when({ - required TResult Function() disabled, - required TResult Function() unique, - required TResult Function(int count) limited, - required TResult Function() all, - }) { - return all(); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? disabled, - TResult? Function()? unique, - TResult? Function(int count)? limited, - TResult? Function()? all, - }) { - return all?.call(); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? disabled, - TResult Function()? unique, - TResult Function(int count)? limited, - TResult Function()? all, - required TResult orElse(), - }) { - if (all != null) { - return all(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(VotingDisabled value) disabled, - required TResult Function(VotingUnique value) unique, - required TResult Function(VotingLimited value) limited, - required TResult Function(VotingAll value) all, - }) { - return all(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(VotingDisabled value)? disabled, - TResult? Function(VotingUnique value)? unique, - TResult? Function(VotingLimited value)? limited, - TResult? Function(VotingAll value)? all, - }) { - return all?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(VotingDisabled value)? disabled, - TResult Function(VotingUnique value)? unique, - TResult Function(VotingLimited value)? limited, - TResult Function(VotingAll value)? all, - required TResult orElse(), - }) { - if (all != null) { - return all(this); - } - return orElse(); + String toString() { + return 'PollVotingMode.all()'; } } -abstract class VotingAll implements PollVotingMode { - const factory VotingAll() = _$VotingAllImpl; -} +// dart format on diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index 1c53c502da..5d170643d6 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: collection: ^1.17.2 dio: ^5.4.3+1 equatable: ^2.0.5 - freezed_annotation: ^2.4.1 + freezed_annotation: ^3.0.0 http_parser: ^4.0.2 jose: ^0.3.4 json_annotation: ^4.9.0 @@ -40,7 +40,7 @@ dependencies: dev_dependencies: build_runner: ^2.4.9 - freezed: ^2.4.2 + freezed: ^3.0.6 json_serializable: ^6.7.1 mocktail: ^1.0.0 test: ^1.24.6 diff --git a/packages/stream_chat_flutter/lib/src/gallery/gallery_footer.dart b/packages/stream_chat_flutter/lib/src/gallery/gallery_footer.dart index 73476c4428..76db88224e 100644 --- a/packages/stream_chat_flutter/lib/src/gallery/gallery_footer.dart +++ b/packages/stream_chat_flutter/lib/src/gallery/gallery_footer.dart @@ -115,13 +115,15 @@ class _StreamGalleryFooterState extends State { final position = (box! as RenderBox).localToGlobal(Offset.zero); - await Share.shareXFiles( - [XFile(filePath)], - sharePositionOrigin: Rect.fromLTWH( - position.dx, - position.dy, - size?.width ?? 50, - (size?.height ?? 2) / 2, + await SharePlus.instance.share( + ShareParams( + files: [XFile(filePath)], + sharePositionOrigin: Rect.fromLTWH( + position.dx, + position.dy, + size?.width ?? 50, + (size?.height ?? 2) / 2, + ), ), ); }, diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index c649a0ef6d..87437b86a5 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -1,8 +1,7 @@ import 'package:jiffy/jiffy.dart'; import 'package:stream_chat_flutter/src/message_list_view/message_list_view.dart'; import 'package:stream_chat_flutter/src/misc/connection_status_builder.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart' - show PollVotingMode, Range, User; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; /// Translation strings for the stream chat widgets abstract class Translations { diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index cafefad7a3..04dd7d6b08 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -43,7 +43,7 @@ dependencies: image_picker: ^1.1.2 image_size_getter: ^2.3.0 jiffy: ^6.2.1 - just_audio: ^0.9.38 + just_audio: ">=0.9.38 <0.11.0" lottie: ^3.1.2 media_kit: ^1.1.10+1 media_kit_video: ^1.2.4 @@ -54,7 +54,7 @@ dependencies: rate_limiter: ^1.0.0 record: ">=5.2.0 <7.0.0" rxdart: ^0.28.0 - share_plus: ^10.0.2 + share_plus: ^11.0.0 shimmer: ^3.0.0 stream_chat_flutter_core: ^9.9.0 svg_icon_widget: ^0.0.1 diff --git a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart index aebd3ad2d4..bcf932b64b 100644 --- a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart +++ b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart @@ -137,3 +137,130 @@ sealed class PagedValue with _$PagedValue { return count; } } + +// coverage:ignore-start + +/// @nodoc +extension PagedValuePatternMatching on PagedValue { + /// @nodoc + @optionalTypeArgs + TResult when( + TResult Function( + List items, + Key? nextPageKey, + StreamChatError? error, + ) success, { + required TResult Function() loading, + required TResult Function(StreamChatError error) error, + }) { + final pagedValue = this; + return switch (pagedValue) { + Success() => success( + pagedValue.items, + pagedValue.nextPageKey, + pagedValue.error, + ), + Loading() => loading(), + Error() => error(pagedValue.error), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? whenOrNull( + TResult Function( + List items, + Key? nextPageKey, + StreamChatError? error, + )? success, { + TResult? Function()? loading, + TResult? Function(StreamChatError error)? error, + }) { + final pagedValue = this; + return switch (pagedValue) { + Success() => success?.call( + pagedValue.items, + pagedValue.nextPageKey, + pagedValue.error, + ), + Loading() => loading?.call(), + Error() => error?.call(pagedValue.error), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + List items, + Key? nextPageKey, + StreamChatError? error, + )? success, { + TResult Function()? loading, + TResult Function(StreamChatError error)? error, + required TResult orElse(), + }) { + final pagedValue = this; + final result = switch (pagedValue) { + Success() => success?.call( + pagedValue.items, + pagedValue.nextPageKey, + pagedValue.error, + ), + Loading() => loading?.call(), + Error() => error?.call(pagedValue.error), + }; + + return result ?? orElse(); + } + + /// @nodoc + @optionalTypeArgs + TResult map( + TResult Function(Success value) success, { + required TResult Function(Loading value) loading, + required TResult Function(Error value) error, + }) { + final pagedValue = this; + return switch (pagedValue) { + Success() => success(pagedValue), + Loading() => loading(pagedValue), + Error() => error(pagedValue), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? mapOrNull( + TResult Function(Success value)? success, { + TResult? Function(Loading value)? loading, + TResult? Function(Error value)? error, + }) { + final pagedValue = this; + return switch (pagedValue) { + Success() => success?.call(pagedValue), + Loading() => loading?.call(pagedValue), + Error() => error?.call(pagedValue), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeMap( + TResult Function(Success value)? success, { + TResult Function(Loading value)? loading, + TResult Function(Error value)? error, + required TResult orElse(), + }) { + final pagedValue = this; + final result = switch (pagedValue) { + Success() => success?.call(pagedValue), + Loading() => loading?.call(pagedValue), + Error() => error?.call(pagedValue), + }; + + return result ?? orElse(); + } +} + +// coverage:ignore-start diff --git a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart index 5d34b66b0f..91d2b61977 100644 --- a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart +++ b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart @@ -1,3 +1,4 @@ +// dart format width=80 // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint @@ -9,136 +10,42 @@ part of 'paged_value_notifier.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -/// @nodoc -mixin _$PagedValue { - @optionalTypeArgs - TResult when( - TResult Function( - List items, Key? nextPageKey, StreamChatError? error) - $default, { - required TResult Function() loading, - required TResult Function(StreamChatError error) error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - List items, Key? nextPageKey, StreamChatError? error)? - $default, { - TResult? Function()? loading, - TResult? Function(StreamChatError error)? error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - List items, Key? nextPageKey, StreamChatError? error)? - $default, { - TResult Function()? loading, - TResult Function(StreamChatError error)? error, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map( - TResult Function(Success value) $default, { - required TResult Function(Loading value) loading, - required TResult Function(Error value) error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(Success value)? $default, { - TResult? Function(Loading value)? loading, - TResult? Function(Error value)? error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap( - TResult Function(Success value)? $default, { - TResult Function(Loading value)? loading, - TResult Function(Error value)? error, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; -} - /// @nodoc -abstract class $PagedValueCopyWith { - factory $PagedValueCopyWith(PagedValue value, - $Res Function(PagedValue) then) = - _$PagedValueCopyWithImpl>; -} +mixin _$PagedValue implements DiagnosticableTreeMixin { + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + properties..add(DiagnosticsProperty('type', 'PagedValue<$Key, $Value>')); + } -/// @nodoc -class _$PagedValueCopyWithImpl> - implements $PagedValueCopyWith { - _$PagedValueCopyWithImpl(this._value, this._then); + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is PagedValue); + } - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + @override + int get hashCode => runtimeType.hashCode; - /// Create a copy of PagedValue - /// with the given fields replaced by the non-null parameter values. + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'PagedValue<$Key, $Value>()'; + } } /// @nodoc -abstract class _$$SuccessImplCopyWith { - factory _$$SuccessImplCopyWith(_$SuccessImpl value, - $Res Function(_$SuccessImpl) then) = - __$$SuccessImplCopyWithImpl; - @useResult - $Res call({List items, Key? nextPageKey, StreamChatError? error}); +class $PagedValueCopyWith { + $PagedValueCopyWith( + PagedValue _, $Res Function(PagedValue) __); } /// @nodoc -class __$$SuccessImplCopyWithImpl - extends _$PagedValueCopyWithImpl> - implements _$$SuccessImplCopyWith { - __$$SuccessImplCopyWithImpl(_$SuccessImpl _value, - $Res Function(_$SuccessImpl) _then) - : super(_value, _then); - /// Create a copy of PagedValue - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? items = null, - Object? nextPageKey = freezed, - Object? error = freezed, - }) { - return _then(_$SuccessImpl( - items: null == items - ? _value._items - : items // ignore: cast_nullable_to_non_nullable - as List, - nextPageKey: freezed == nextPageKey - ? _value.nextPageKey - : nextPageKey // ignore: cast_nullable_to_non_nullable - as Key?, - error: freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as StreamChatError?, - )); - } -} - -/// @nodoc - -class _$SuccessImpl extends Success +class Success extends PagedValue with DiagnosticableTreeMixin { - const _$SuccessImpl( + const Success( {required final List items, this.nextPageKey, this.error}) : _items = items, super._(); @@ -147,7 +54,6 @@ class _$SuccessImpl extends Success final List _items; /// List with all items loaded so far. - @override List get items { if (_items is EqualUnmodifiableListView) return _items; // ignore: implicit_dynamic_type @@ -155,21 +61,20 @@ class _$SuccessImpl extends Success } /// The key for the next page to be fetched. - @override final Key? nextPageKey; /// The current error, if any. - @override final StreamChatError? error; - @override - String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'PagedValue<$Key, $Value>(items: $items, nextPageKey: $nextPageKey, error: $error)'; - } + /// Create a copy of PagedValue + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SuccessCopyWith> get copyWith => + _$SuccessCopyWithImpl>(this, _$identity); @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { - super.debugFillProperties(properties); properties ..add(DiagnosticsProperty('type', 'PagedValue<$Key, $Value>')) ..add(DiagnosticsProperty('items', items)) @@ -181,7 +86,7 @@ class _$SuccessImpl extends Success bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$SuccessImpl && + other is Success && const DeepCollectionEquality().equals(other._items, _items) && const DeepCollectionEquality() .equals(other.nextPageKey, nextPageKey) && @@ -195,291 +100,99 @@ class _$SuccessImpl extends Success const DeepCollectionEquality().hash(nextPageKey), error); - /// Create a copy of PagedValue - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$SuccessImplCopyWith> get copyWith => - __$$SuccessImplCopyWithImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - List items, Key? nextPageKey, StreamChatError? error) - $default, { - required TResult Function() loading, - required TResult Function(StreamChatError error) error, - }) { - return $default(items, nextPageKey, this.error); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - List items, Key? nextPageKey, StreamChatError? error)? - $default, { - TResult? Function()? loading, - TResult? Function(StreamChatError error)? error, - }) { - return $default?.call(items, nextPageKey, this.error); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - List items, Key? nextPageKey, StreamChatError? error)? - $default, { - TResult Function()? loading, - TResult Function(StreamChatError error)? error, - required TResult orElse(), - }) { - if ($default != null) { - return $default(items, nextPageKey, this.error); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(Success value) $default, { - required TResult Function(Loading value) loading, - required TResult Function(Error value) error, - }) { - return $default(this); - } - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(Success value)? $default, { - TResult? Function(Loading value)? loading, - TResult? Function(Error value)? error, - }) { - return $default?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(Success value)? $default, { - TResult Function(Loading value)? loading, - TResult Function(Error value)? error, - required TResult orElse(), - }) { - if ($default != null) { - return $default(this); - } - return orElse(); + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'PagedValue<$Key, $Value>(items: $items, nextPageKey: $nextPageKey, error: $error)'; } } -abstract class Success extends PagedValue { - const factory Success( - {required final List items, - final Key? nextPageKey, - final StreamChatError? error}) = _$SuccessImpl; - const Success._() : super._(); - - /// List with all items loaded so far. - List get items; - - /// The key for the next page to be fetched. - Key? get nextPageKey; - - /// The current error, if any. - StreamChatError? get error; - - /// Create a copy of PagedValue - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$SuccessImplCopyWith> get copyWith => - throw _privateConstructorUsedError; -} - /// @nodoc -abstract class _$$LoadingImplCopyWith { - factory _$$LoadingImplCopyWith(_$LoadingImpl value, - $Res Function(_$LoadingImpl) then) = - __$$LoadingImplCopyWithImpl; +abstract mixin class $SuccessCopyWith + implements $PagedValueCopyWith { + factory $SuccessCopyWith( + Success value, $Res Function(Success) _then) = + _$SuccessCopyWithImpl; + @useResult + $Res call({List items, Key? nextPageKey, StreamChatError? error}); } /// @nodoc -class __$$LoadingImplCopyWithImpl - extends _$PagedValueCopyWithImpl> - implements _$$LoadingImplCopyWith { - __$$LoadingImplCopyWithImpl(_$LoadingImpl _value, - $Res Function(_$LoadingImpl) _then) - : super(_value, _then); +class _$SuccessCopyWithImpl + implements $SuccessCopyWith { + _$SuccessCopyWithImpl(this._self, this._then); + + final Success _self; + final $Res Function(Success) _then; /// Create a copy of PagedValue /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + $Res call({ + Object? items = null, + Object? nextPageKey = freezed, + Object? error = freezed, + }) { + return _then(Success( + items: null == items + ? _self._items + : items // ignore: cast_nullable_to_non_nullable + as List, + nextPageKey: freezed == nextPageKey + ? _self.nextPageKey + : nextPageKey // ignore: cast_nullable_to_non_nullable + as Key?, + error: freezed == error + ? _self.error + : error // ignore: cast_nullable_to_non_nullable + as StreamChatError?, + )); + } } /// @nodoc -class _$LoadingImpl extends Loading +class Loading extends PagedValue with DiagnosticableTreeMixin { - const _$LoadingImpl() : super._(); - - @override - String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'PagedValue<$Key, $Value>.loading()'; - } + const Loading() : super._(); @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { - super.debugFillProperties(properties); properties - .add(DiagnosticsProperty('type', 'PagedValue<$Key, $Value>.loading')); + ..add(DiagnosticsProperty('type', 'PagedValue<$Key, $Value>.loading')); } @override bool operator ==(Object other) { return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$LoadingImpl); + (other.runtimeType == runtimeType && other is Loading); } @override int get hashCode => runtimeType.hashCode; @override - @optionalTypeArgs - TResult when( - TResult Function( - List items, Key? nextPageKey, StreamChatError? error) - $default, { - required TResult Function() loading, - required TResult Function(StreamChatError error) error, - }) { - return loading(); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - List items, Key? nextPageKey, StreamChatError? error)? - $default, { - TResult? Function()? loading, - TResult? Function(StreamChatError error)? error, - }) { - return loading?.call(); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - List items, Key? nextPageKey, StreamChatError? error)? - $default, { - TResult Function()? loading, - TResult Function(StreamChatError error)? error, - required TResult orElse(), - }) { - if (loading != null) { - return loading(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map( - TResult Function(Success value) $default, { - required TResult Function(Loading value) loading, - required TResult Function(Error value) error, - }) { - return loading(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(Success value)? $default, { - TResult? Function(Loading value)? loading, - TResult? Function(Error value)? error, - }) { - return loading?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(Success value)? $default, { - TResult Function(Loading value)? loading, - TResult Function(Error value)? error, - required TResult orElse(), - }) { - if (loading != null) { - return loading(this); - } - return orElse(); - } -} - -abstract class Loading extends PagedValue { - const factory Loading() = _$LoadingImpl; - const Loading._() : super._(); -} - -/// @nodoc -abstract class _$$ErrorImplCopyWith { - factory _$$ErrorImplCopyWith(_$ErrorImpl value, - $Res Function(_$ErrorImpl) then) = - __$$ErrorImplCopyWithImpl; - @useResult - $Res call({StreamChatError error}); -} - -/// @nodoc -class __$$ErrorImplCopyWithImpl - extends _$PagedValueCopyWithImpl> - implements _$$ErrorImplCopyWith { - __$$ErrorImplCopyWithImpl(_$ErrorImpl _value, - $Res Function(_$ErrorImpl) _then) - : super(_value, _then); - - /// Create a copy of PagedValue - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? error = null, - }) { - return _then(_$ErrorImpl( - null == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as StreamChatError, - )); + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'PagedValue<$Key, $Value>.loading()'; } } /// @nodoc -class _$ErrorImpl extends Error +class Error extends PagedValue with DiagnosticableTreeMixin { - const _$ErrorImpl(this.error) : super._(); + const Error(this.error) : super._(); - @override final StreamChatError error; - @override - String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'PagedValue<$Key, $Value>.error(error: $error)'; - } + /// Create a copy of PagedValue + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ErrorCopyWith> get copyWith => + _$ErrorCopyWithImpl>(this, _$identity); @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { - super.debugFillProperties(properties); properties ..add(DiagnosticsProperty('type', 'PagedValue<$Key, $Value>.error')) ..add(DiagnosticsProperty('error', error)); @@ -489,106 +202,50 @@ class _$ErrorImpl extends Error bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ErrorImpl && + other is Error && (identical(other.error, error) || other.error == error)); } @override int get hashCode => Object.hash(runtimeType, error); - /// Create a copy of PagedValue - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$ErrorImplCopyWith> get copyWith => - __$$ErrorImplCopyWithImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when( - TResult Function( - List items, Key? nextPageKey, StreamChatError? error) - $default, { - required TResult Function() loading, - required TResult Function(StreamChatError error) error, - }) { - return error(this.error); - } - - @override - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - List items, Key? nextPageKey, StreamChatError? error)? - $default, { - TResult? Function()? loading, - TResult? Function(StreamChatError error)? error, - }) { - return error?.call(this.error); - } - - @override - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - List items, Key? nextPageKey, StreamChatError? error)? - $default, { - TResult Function()? loading, - TResult Function(StreamChatError error)? error, - required TResult orElse(), - }) { - if (error != null) { - return error(this.error); - } - return orElse(); - } - @override - @optionalTypeArgs - TResult map( - TResult Function(Success value) $default, { - required TResult Function(Loading value) loading, - required TResult Function(Error value) error, - }) { - return error(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(Success value)? $default, { - TResult? Function(Loading value)? loading, - TResult? Function(Error value)? error, - }) { - return error?.call(this); + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'PagedValue<$Key, $Value>.error(error: $error)'; } +} - @override - @optionalTypeArgs - TResult maybeMap( - TResult Function(Success value)? $default, { - TResult Function(Loading value)? loading, - TResult Function(Error value)? error, - required TResult orElse(), - }) { - if (error != null) { - return error(this); - } - return orElse(); - } +/// @nodoc +abstract mixin class $ErrorCopyWith + implements $PagedValueCopyWith { + factory $ErrorCopyWith( + Error value, $Res Function(Error) _then) = + _$ErrorCopyWithImpl; + @useResult + $Res call({StreamChatError error}); } -abstract class Error extends PagedValue { - const factory Error(final StreamChatError error) = _$ErrorImpl; - const Error._() : super._(); +/// @nodoc +class _$ErrorCopyWithImpl + implements $ErrorCopyWith { + _$ErrorCopyWithImpl(this._self, this._then); - StreamChatError get error; + final Error _self; + final $Res Function(Error) _then; /// Create a copy of PagedValue /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$ErrorImplCopyWith> get copyWith => - throw _privateConstructorUsedError; + @pragma('vm:prefer-inline') + $Res call({ + Object? error = null, + }) { + return _then(Error( + null == error + ? _self.error + : error // ignore: cast_nullable_to_non_nullable + as StreamChatError, + )); + } } + +// dart format on diff --git a/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart index 6fccd13007..ee3643a4dd 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart @@ -282,3 +282,137 @@ sealed class PollValidationError with _$PollValidationError { required Range range, }) = _PollValidationErrorMaxVotesAllowed; } + +// coverage:ignore-start + +/// @nodoc +extension PollValidationErrorPatternMatching on PollValidationError { + /// @nodoc + @optionalTypeArgs + TResult when({ + required TResult Function(List options) duplicateOptions, + required TResult Function(String name, Range range) nameRange, + required TResult Function(List options, Range range) + optionsRange, + required TResult Function(int maxVotesAllowed, Range range) + maxVotesAllowed, + }) { + final error = this; + return switch (error) { + _PollValidationErrorDuplicateOptions() => duplicateOptions(error.options), + _PollValidationErrorNameRange() => nameRange(error.name, error.range), + _PollValidationErrorOptionsRange() => + optionsRange(error.options, error.range), + _PollValidationErrorMaxVotesAllowed() => + maxVotesAllowed(error.maxVotesAllowed, error.range), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(List options)? duplicateOptions, + TResult? Function(String name, Range range)? nameRange, + TResult? Function(List options, Range range)? optionsRange, + TResult? Function(int maxVotesAllowed, Range range)? maxVotesAllowed, + }) { + final error = this; + return switch (error) { + _PollValidationErrorDuplicateOptions() => + duplicateOptions?.call(error.options), + _PollValidationErrorNameRange() => + nameRange?.call(error.name, error.range), + _PollValidationErrorOptionsRange() => + optionsRange?.call(error.options, error.range), + _PollValidationErrorMaxVotesAllowed() => + maxVotesAllowed?.call(error.maxVotesAllowed, error.range), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(List options)? duplicateOptions, + TResult Function(String name, Range range)? nameRange, + TResult Function(List options, Range range)? optionsRange, + TResult Function(int maxVotesAllowed, Range range)? maxVotesAllowed, + required TResult orElse(), + }) { + final error = this; + final result = switch (error) { + _PollValidationErrorDuplicateOptions() => + duplicateOptions?.call(error.options), + _PollValidationErrorNameRange() => + nameRange?.call(error.name, error.range), + _PollValidationErrorOptionsRange() => + optionsRange?.call(error.options, error.range), + _PollValidationErrorMaxVotesAllowed() => + maxVotesAllowed?.call(error.maxVotesAllowed, error.range), + }; + + return result ?? orElse(); + } + + /// @nodoc + @optionalTypeArgs + TResult map({ + required TResult Function(_PollValidationErrorDuplicateOptions value) + duplicateOptions, + required TResult Function(_PollValidationErrorNameRange value) nameRange, + required TResult Function(_PollValidationErrorOptionsRange value) + optionsRange, + required TResult Function(_PollValidationErrorMaxVotesAllowed value) + maxVotesAllowed, + }) { + final error = this; + return switch (error) { + _PollValidationErrorDuplicateOptions() => duplicateOptions(error), + _PollValidationErrorNameRange() => nameRange(error), + _PollValidationErrorOptionsRange() => optionsRange(error), + _PollValidationErrorMaxVotesAllowed() => maxVotesAllowed(error), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(_PollValidationErrorDuplicateOptions value)? + duplicateOptions, + TResult? Function(_PollValidationErrorNameRange value)? nameRange, + TResult? Function(_PollValidationErrorOptionsRange value)? optionsRange, + TResult? Function(_PollValidationErrorMaxVotesAllowed value)? + maxVotesAllowed, + }) { + final error = this; + return switch (error) { + _PollValidationErrorDuplicateOptions() => duplicateOptions?.call(error), + _PollValidationErrorNameRange() => nameRange?.call(error), + _PollValidationErrorOptionsRange() => optionsRange?.call(error), + _PollValidationErrorMaxVotesAllowed() => maxVotesAllowed?.call(error), + }; + } + + /// @nodoc + @optionalTypeArgs + TResult maybeMap({ + TResult Function(_PollValidationErrorDuplicateOptions value)? + duplicateOptions, + TResult Function(_PollValidationErrorNameRange value)? nameRange, + TResult Function(_PollValidationErrorOptionsRange value)? optionsRange, + TResult Function(_PollValidationErrorMaxVotesAllowed value)? + maxVotesAllowed, + required TResult orElse(), + }) { + final error = this; + final result = switch (error) { + _PollValidationErrorDuplicateOptions() => duplicateOptions?.call(error), + _PollValidationErrorNameRange() => nameRange?.call(error), + _PollValidationErrorOptionsRange() => optionsRange?.call(error), + _PollValidationErrorMaxVotesAllowed() => maxVotesAllowed?.call(error), + }; + + return result ?? orElse(); + } +} + +// coverage:ignore-start diff --git a/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.freezed.dart b/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.freezed.dart index 5bacc5ef02..182a1e5128 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.freezed.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.freezed.dart @@ -1,3 +1,4 @@ +// dart format width=80 // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint @@ -9,163 +10,59 @@ part of 'stream_poll_controller.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - /// @nodoc mixin _$PollValidationError { - @optionalTypeArgs - TResult when({ - required TResult Function(List options) duplicateOptions, - required TResult Function(String name, ({int? max, int? min}) range) - nameRange, - required TResult Function( - List options, ({int? max, int? min}) range) - optionsRange, - required TResult Function(int maxVotesAllowed, ({int? max, int? min}) range) - maxVotesAllowed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(List options)? duplicateOptions, - TResult? Function(String name, ({int? max, int? min}) range)? nameRange, - TResult? Function(List options, ({int? max, int? min}) range)? - optionsRange, - TResult? Function(int maxVotesAllowed, ({int? max, int? min}) range)? - maxVotesAllowed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(List options)? duplicateOptions, - TResult Function(String name, ({int? max, int? min}) range)? nameRange, - TResult Function(List options, ({int? max, int? min}) range)? - optionsRange, - TResult Function(int maxVotesAllowed, ({int? max, int? min}) range)? - maxVotesAllowed, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(_PollValidationErrorDuplicateOptions value) - duplicateOptions, - required TResult Function(_PollValidationErrorNameRange value) nameRange, - required TResult Function(_PollValidationErrorOptionsRange value) - optionsRange, - required TResult Function(_PollValidationErrorMaxVotesAllowed value) - maxVotesAllowed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_PollValidationErrorDuplicateOptions value)? - duplicateOptions, - TResult? Function(_PollValidationErrorNameRange value)? nameRange, - TResult? Function(_PollValidationErrorOptionsRange value)? optionsRange, - TResult? Function(_PollValidationErrorMaxVotesAllowed value)? - maxVotesAllowed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_PollValidationErrorDuplicateOptions value)? - duplicateOptions, - TResult Function(_PollValidationErrorNameRange value)? nameRange, - TResult Function(_PollValidationErrorOptionsRange value)? optionsRange, - TResult Function(_PollValidationErrorMaxVotesAllowed value)? - maxVotesAllowed, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $PollValidationErrorCopyWith<$Res> { - factory $PollValidationErrorCopyWith( - PollValidationError value, $Res Function(PollValidationError) then) = - _$PollValidationErrorCopyWithImpl<$Res, PollValidationError>; -} - -/// @nodoc -class _$PollValidationErrorCopyWithImpl<$Res, $Val extends PollValidationError> - implements $PollValidationErrorCopyWith<$Res> { - _$PollValidationErrorCopyWithImpl(this._value, this._then); + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is PollValidationError); + } - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + @override + int get hashCode => runtimeType.hashCode; - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. + @override + String toString() { + return 'PollValidationError()'; + } } /// @nodoc -abstract class _$$PollValidationErrorDuplicateOptionsImplCopyWith<$Res> { - factory _$$PollValidationErrorDuplicateOptionsImplCopyWith( - _$PollValidationErrorDuplicateOptionsImpl value, - $Res Function(_$PollValidationErrorDuplicateOptionsImpl) then) = - __$$PollValidationErrorDuplicateOptionsImplCopyWithImpl<$Res>; - @useResult - $Res call({List options}); +class $PollValidationErrorCopyWith<$Res> { + $PollValidationErrorCopyWith( + PollValidationError _, $Res Function(PollValidationError) __); } /// @nodoc -class __$$PollValidationErrorDuplicateOptionsImplCopyWithImpl<$Res> - extends _$PollValidationErrorCopyWithImpl<$Res, - _$PollValidationErrorDuplicateOptionsImpl> - implements _$$PollValidationErrorDuplicateOptionsImplCopyWith<$Res> { - __$$PollValidationErrorDuplicateOptionsImplCopyWithImpl( - _$PollValidationErrorDuplicateOptionsImpl _value, - $Res Function(_$PollValidationErrorDuplicateOptionsImpl) _then) - : super(_value, _then); - - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? options = null, - }) { - return _then(_$PollValidationErrorDuplicateOptionsImpl( - null == options - ? _value._options - : options // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} -/// @nodoc - -class _$PollValidationErrorDuplicateOptionsImpl - implements _PollValidationErrorDuplicateOptions { - const _$PollValidationErrorDuplicateOptionsImpl( - final List options) +class _PollValidationErrorDuplicateOptions implements PollValidationError { + const _PollValidationErrorDuplicateOptions(final List options) : _options = options; final List _options; - @override List get options { if (_options is EqualUnmodifiableListView) return _options; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(_options); } - @override - String toString() { - return 'PollValidationError.duplicateOptions(options: $options)'; - } + /// Create a copy of PollValidationError + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PollValidationErrorDuplicateOptionsCopyWith< + _PollValidationErrorDuplicateOptions> + get copyWith => __$PollValidationErrorDuplicateOptionsCopyWithImpl< + _PollValidationErrorDuplicateOptions>(this, _$identity); @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PollValidationErrorDuplicateOptionsImpl && + other is _PollValidationErrorDuplicateOptions && const DeepCollectionEquality().equals(other._options, _options)); } @@ -173,184 +70,67 @@ class _$PollValidationErrorDuplicateOptionsImpl int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_options)); - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PollValidationErrorDuplicateOptionsImplCopyWith< - _$PollValidationErrorDuplicateOptionsImpl> - get copyWith => __$$PollValidationErrorDuplicateOptionsImplCopyWithImpl< - _$PollValidationErrorDuplicateOptionsImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(List options) duplicateOptions, - required TResult Function(String name, ({int? max, int? min}) range) - nameRange, - required TResult Function( - List options, ({int? max, int? min}) range) - optionsRange, - required TResult Function(int maxVotesAllowed, ({int? max, int? min}) range) - maxVotesAllowed, - }) { - return duplicateOptions(options); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(List options)? duplicateOptions, - TResult? Function(String name, ({int? max, int? min}) range)? nameRange, - TResult? Function(List options, ({int? max, int? min}) range)? - optionsRange, - TResult? Function(int maxVotesAllowed, ({int? max, int? min}) range)? - maxVotesAllowed, - }) { - return duplicateOptions?.call(options); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(List options)? duplicateOptions, - TResult Function(String name, ({int? max, int? min}) range)? nameRange, - TResult Function(List options, ({int? max, int? min}) range)? - optionsRange, - TResult Function(int maxVotesAllowed, ({int? max, int? min}) range)? - maxVotesAllowed, - required TResult orElse(), - }) { - if (duplicateOptions != null) { - return duplicateOptions(options); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_PollValidationErrorDuplicateOptions value) - duplicateOptions, - required TResult Function(_PollValidationErrorNameRange value) nameRange, - required TResult Function(_PollValidationErrorOptionsRange value) - optionsRange, - required TResult Function(_PollValidationErrorMaxVotesAllowed value) - maxVotesAllowed, - }) { - return duplicateOptions(this); - } - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_PollValidationErrorDuplicateOptions value)? - duplicateOptions, - TResult? Function(_PollValidationErrorNameRange value)? nameRange, - TResult? Function(_PollValidationErrorOptionsRange value)? optionsRange, - TResult? Function(_PollValidationErrorMaxVotesAllowed value)? - maxVotesAllowed, - }) { - return duplicateOptions?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_PollValidationErrorDuplicateOptions value)? - duplicateOptions, - TResult Function(_PollValidationErrorNameRange value)? nameRange, - TResult Function(_PollValidationErrorOptionsRange value)? optionsRange, - TResult Function(_PollValidationErrorMaxVotesAllowed value)? - maxVotesAllowed, - required TResult orElse(), - }) { - if (duplicateOptions != null) { - return duplicateOptions(this); - } - return orElse(); + String toString() { + return 'PollValidationError.duplicateOptions(options: $options)'; } } -abstract class _PollValidationErrorDuplicateOptions - implements PollValidationError { - const factory _PollValidationErrorDuplicateOptions( - final List options) = - _$PollValidationErrorDuplicateOptionsImpl; - - List get options; - - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PollValidationErrorDuplicateOptionsImplCopyWith< - _$PollValidationErrorDuplicateOptionsImpl> - get copyWith => throw _privateConstructorUsedError; -} - /// @nodoc -abstract class _$$PollValidationErrorNameRangeImplCopyWith<$Res> { - factory _$$PollValidationErrorNameRangeImplCopyWith( - _$PollValidationErrorNameRangeImpl value, - $Res Function(_$PollValidationErrorNameRangeImpl) then) = - __$$PollValidationErrorNameRangeImplCopyWithImpl<$Res>; +abstract mixin class _$PollValidationErrorDuplicateOptionsCopyWith<$Res> + implements $PollValidationErrorCopyWith<$Res> { + factory _$PollValidationErrorDuplicateOptionsCopyWith( + _PollValidationErrorDuplicateOptions value, + $Res Function(_PollValidationErrorDuplicateOptions) _then) = + __$PollValidationErrorDuplicateOptionsCopyWithImpl; @useResult - $Res call({String name, ({int? max, int? min}) range}); + $Res call({List options}); } /// @nodoc -class __$$PollValidationErrorNameRangeImplCopyWithImpl<$Res> - extends _$PollValidationErrorCopyWithImpl<$Res, - _$PollValidationErrorNameRangeImpl> - implements _$$PollValidationErrorNameRangeImplCopyWith<$Res> { - __$$PollValidationErrorNameRangeImplCopyWithImpl( - _$PollValidationErrorNameRangeImpl _value, - $Res Function(_$PollValidationErrorNameRangeImpl) _then) - : super(_value, _then); +class __$PollValidationErrorDuplicateOptionsCopyWithImpl<$Res> + implements _$PollValidationErrorDuplicateOptionsCopyWith<$Res> { + __$PollValidationErrorDuplicateOptionsCopyWithImpl(this._self, this._then); + + final _PollValidationErrorDuplicateOptions _self; + final $Res Function(_PollValidationErrorDuplicateOptions) _then; /// Create a copy of PollValidationError /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') - @override $Res call({ - Object? name = null, - Object? range = null, + Object? options = null, }) { - return _then(_$PollValidationErrorNameRangeImpl( - null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - range: null == range - ? _value.range - : range // ignore: cast_nullable_to_non_nullable - as ({int? max, int? min}), + return _then(_PollValidationErrorDuplicateOptions( + null == options + ? _self._options + : options // ignore: cast_nullable_to_non_nullable + as List, )); } } /// @nodoc -class _$PollValidationErrorNameRangeImpl - implements _PollValidationErrorNameRange { - const _$PollValidationErrorNameRangeImpl(this.name, {required this.range}); +class _PollValidationErrorNameRange implements PollValidationError { + const _PollValidationErrorNameRange(this.name, {required this.range}); - @override final String name; - @override - final ({int? max, int? min}) range; + final Range range; - @override - String toString() { - return 'PollValidationError.nameRange(name: $name, range: $range)'; - } + /// Create a copy of PollValidationError + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PollValidationErrorNameRangeCopyWith<_PollValidationErrorNameRange> + get copyWith => __$PollValidationErrorNameRangeCopyWithImpl< + _PollValidationErrorNameRange>(this, _$identity); @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PollValidationErrorNameRangeImpl && + other is _PollValidationErrorNameRange && (identical(other.name, name) || other.name == name) && (identical(other.range, range) || other.range == range)); } @@ -358,192 +138,80 @@ class _$PollValidationErrorNameRangeImpl @override int get hashCode => Object.hash(runtimeType, name, range); - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) @override - @pragma('vm:prefer-inline') - _$$PollValidationErrorNameRangeImplCopyWith< - _$PollValidationErrorNameRangeImpl> - get copyWith => __$$PollValidationErrorNameRangeImplCopyWithImpl< - _$PollValidationErrorNameRangeImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(List options) duplicateOptions, - required TResult Function(String name, ({int? max, int? min}) range) - nameRange, - required TResult Function( - List options, ({int? max, int? min}) range) - optionsRange, - required TResult Function(int maxVotesAllowed, ({int? max, int? min}) range) - maxVotesAllowed, - }) { - return nameRange(name, range); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(List options)? duplicateOptions, - TResult? Function(String name, ({int? max, int? min}) range)? nameRange, - TResult? Function(List options, ({int? max, int? min}) range)? - optionsRange, - TResult? Function(int maxVotesAllowed, ({int? max, int? min}) range)? - maxVotesAllowed, - }) { - return nameRange?.call(name, range); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(List options)? duplicateOptions, - TResult Function(String name, ({int? max, int? min}) range)? nameRange, - TResult Function(List options, ({int? max, int? min}) range)? - optionsRange, - TResult Function(int maxVotesAllowed, ({int? max, int? min}) range)? - maxVotesAllowed, - required TResult orElse(), - }) { - if (nameRange != null) { - return nameRange(name, range); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_PollValidationErrorDuplicateOptions value) - duplicateOptions, - required TResult Function(_PollValidationErrorNameRange value) nameRange, - required TResult Function(_PollValidationErrorOptionsRange value) - optionsRange, - required TResult Function(_PollValidationErrorMaxVotesAllowed value) - maxVotesAllowed, - }) { - return nameRange(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_PollValidationErrorDuplicateOptions value)? - duplicateOptions, - TResult? Function(_PollValidationErrorNameRange value)? nameRange, - TResult? Function(_PollValidationErrorOptionsRange value)? optionsRange, - TResult? Function(_PollValidationErrorMaxVotesAllowed value)? - maxVotesAllowed, - }) { - return nameRange?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_PollValidationErrorDuplicateOptions value)? - duplicateOptions, - TResult Function(_PollValidationErrorNameRange value)? nameRange, - TResult Function(_PollValidationErrorOptionsRange value)? optionsRange, - TResult Function(_PollValidationErrorMaxVotesAllowed value)? - maxVotesAllowed, - required TResult orElse(), - }) { - if (nameRange != null) { - return nameRange(this); - } - return orElse(); + String toString() { + return 'PollValidationError.nameRange(name: $name, range: $range)'; } } -abstract class _PollValidationErrorNameRange implements PollValidationError { - const factory _PollValidationErrorNameRange(final String name, - {required final ({int? max, int? min}) range}) = - _$PollValidationErrorNameRangeImpl; - - String get name; - ({int? max, int? min}) get range; - - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PollValidationErrorNameRangeImplCopyWith< - _$PollValidationErrorNameRangeImpl> - get copyWith => throw _privateConstructorUsedError; -} - /// @nodoc -abstract class _$$PollValidationErrorOptionsRangeImplCopyWith<$Res> { - factory _$$PollValidationErrorOptionsRangeImplCopyWith( - _$PollValidationErrorOptionsRangeImpl value, - $Res Function(_$PollValidationErrorOptionsRangeImpl) then) = - __$$PollValidationErrorOptionsRangeImplCopyWithImpl<$Res>; +abstract mixin class _$PollValidationErrorNameRangeCopyWith<$Res> + implements $PollValidationErrorCopyWith<$Res> { + factory _$PollValidationErrorNameRangeCopyWith( + _PollValidationErrorNameRange value, + $Res Function(_PollValidationErrorNameRange) _then) = + __$PollValidationErrorNameRangeCopyWithImpl; @useResult - $Res call({List options, ({int? max, int? min}) range}); + $Res call({String name, Range range}); } /// @nodoc -class __$$PollValidationErrorOptionsRangeImplCopyWithImpl<$Res> - extends _$PollValidationErrorCopyWithImpl<$Res, - _$PollValidationErrorOptionsRangeImpl> - implements _$$PollValidationErrorOptionsRangeImplCopyWith<$Res> { - __$$PollValidationErrorOptionsRangeImplCopyWithImpl( - _$PollValidationErrorOptionsRangeImpl _value, - $Res Function(_$PollValidationErrorOptionsRangeImpl) _then) - : super(_value, _then); +class __$PollValidationErrorNameRangeCopyWithImpl<$Res> + implements _$PollValidationErrorNameRangeCopyWith<$Res> { + __$PollValidationErrorNameRangeCopyWithImpl(this._self, this._then); + + final _PollValidationErrorNameRange _self; + final $Res Function(_PollValidationErrorNameRange) _then; /// Create a copy of PollValidationError /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') - @override $Res call({ - Object? options = null, + Object? name = null, Object? range = null, }) { - return _then(_$PollValidationErrorOptionsRangeImpl( - null == options - ? _value._options - : options // ignore: cast_nullable_to_non_nullable - as List, + return _then(_PollValidationErrorNameRange( + null == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String, range: null == range - ? _value.range + ? _self.range : range // ignore: cast_nullable_to_non_nullable - as ({int? max, int? min}), + as Range, )); } } /// @nodoc -class _$PollValidationErrorOptionsRangeImpl - implements _PollValidationErrorOptionsRange { - const _$PollValidationErrorOptionsRangeImpl(final List options, +class _PollValidationErrorOptionsRange implements PollValidationError { + const _PollValidationErrorOptionsRange(final List options, {required this.range}) : _options = options; final List _options; - @override List get options { if (_options is EqualUnmodifiableListView) return _options; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(_options); } - @override - final ({int? max, int? min}) range; + final Range range; - @override - String toString() { - return 'PollValidationError.optionsRange(options: $options, range: $range)'; - } + /// Create a copy of PollValidationError + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PollValidationErrorOptionsRangeCopyWith<_PollValidationErrorOptionsRange> + get copyWith => __$PollValidationErrorOptionsRangeCopyWithImpl< + _PollValidationErrorOptionsRange>(this, _$identity); @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PollValidationErrorOptionsRangeImpl && + other is _PollValidationErrorOptionsRange && const DeepCollectionEquality().equals(other._options, _options) && (identical(other.range, range) || other.range == range)); } @@ -552,185 +220,74 @@ class _$PollValidationErrorOptionsRangeImpl int get hashCode => Object.hash( runtimeType, const DeepCollectionEquality().hash(_options), range); - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) @override - @pragma('vm:prefer-inline') - _$$PollValidationErrorOptionsRangeImplCopyWith< - _$PollValidationErrorOptionsRangeImpl> - get copyWith => __$$PollValidationErrorOptionsRangeImplCopyWithImpl< - _$PollValidationErrorOptionsRangeImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(List options) duplicateOptions, - required TResult Function(String name, ({int? max, int? min}) range) - nameRange, - required TResult Function( - List options, ({int? max, int? min}) range) - optionsRange, - required TResult Function(int maxVotesAllowed, ({int? max, int? min}) range) - maxVotesAllowed, - }) { - return optionsRange(options, range); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(List options)? duplicateOptions, - TResult? Function(String name, ({int? max, int? min}) range)? nameRange, - TResult? Function(List options, ({int? max, int? min}) range)? - optionsRange, - TResult? Function(int maxVotesAllowed, ({int? max, int? min}) range)? - maxVotesAllowed, - }) { - return optionsRange?.call(options, range); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(List options)? duplicateOptions, - TResult Function(String name, ({int? max, int? min}) range)? nameRange, - TResult Function(List options, ({int? max, int? min}) range)? - optionsRange, - TResult Function(int maxVotesAllowed, ({int? max, int? min}) range)? - maxVotesAllowed, - required TResult orElse(), - }) { - if (optionsRange != null) { - return optionsRange(options, range); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_PollValidationErrorDuplicateOptions value) - duplicateOptions, - required TResult Function(_PollValidationErrorNameRange value) nameRange, - required TResult Function(_PollValidationErrorOptionsRange value) - optionsRange, - required TResult Function(_PollValidationErrorMaxVotesAllowed value) - maxVotesAllowed, - }) { - return optionsRange(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_PollValidationErrorDuplicateOptions value)? - duplicateOptions, - TResult? Function(_PollValidationErrorNameRange value)? nameRange, - TResult? Function(_PollValidationErrorOptionsRange value)? optionsRange, - TResult? Function(_PollValidationErrorMaxVotesAllowed value)? - maxVotesAllowed, - }) { - return optionsRange?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_PollValidationErrorDuplicateOptions value)? - duplicateOptions, - TResult Function(_PollValidationErrorNameRange value)? nameRange, - TResult Function(_PollValidationErrorOptionsRange value)? optionsRange, - TResult Function(_PollValidationErrorMaxVotesAllowed value)? - maxVotesAllowed, - required TResult orElse(), - }) { - if (optionsRange != null) { - return optionsRange(this); - } - return orElse(); + String toString() { + return 'PollValidationError.optionsRange(options: $options, range: $range)'; } } -abstract class _PollValidationErrorOptionsRange implements PollValidationError { - const factory _PollValidationErrorOptionsRange(final List options, - {required final ({int? max, int? min}) range}) = - _$PollValidationErrorOptionsRangeImpl; - - List get options; - ({int? max, int? min}) get range; - - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PollValidationErrorOptionsRangeImplCopyWith< - _$PollValidationErrorOptionsRangeImpl> - get copyWith => throw _privateConstructorUsedError; -} - /// @nodoc -abstract class _$$PollValidationErrorMaxVotesAllowedImplCopyWith<$Res> { - factory _$$PollValidationErrorMaxVotesAllowedImplCopyWith( - _$PollValidationErrorMaxVotesAllowedImpl value, - $Res Function(_$PollValidationErrorMaxVotesAllowedImpl) then) = - __$$PollValidationErrorMaxVotesAllowedImplCopyWithImpl<$Res>; +abstract mixin class _$PollValidationErrorOptionsRangeCopyWith<$Res> + implements $PollValidationErrorCopyWith<$Res> { + factory _$PollValidationErrorOptionsRangeCopyWith( + _PollValidationErrorOptionsRange value, + $Res Function(_PollValidationErrorOptionsRange) _then) = + __$PollValidationErrorOptionsRangeCopyWithImpl; @useResult - $Res call({int maxVotesAllowed, ({int? max, int? min}) range}); + $Res call({List options, Range range}); } /// @nodoc -class __$$PollValidationErrorMaxVotesAllowedImplCopyWithImpl<$Res> - extends _$PollValidationErrorCopyWithImpl<$Res, - _$PollValidationErrorMaxVotesAllowedImpl> - implements _$$PollValidationErrorMaxVotesAllowedImplCopyWith<$Res> { - __$$PollValidationErrorMaxVotesAllowedImplCopyWithImpl( - _$PollValidationErrorMaxVotesAllowedImpl _value, - $Res Function(_$PollValidationErrorMaxVotesAllowedImpl) _then) - : super(_value, _then); +class __$PollValidationErrorOptionsRangeCopyWithImpl<$Res> + implements _$PollValidationErrorOptionsRangeCopyWith<$Res> { + __$PollValidationErrorOptionsRangeCopyWithImpl(this._self, this._then); + + final _PollValidationErrorOptionsRange _self; + final $Res Function(_PollValidationErrorOptionsRange) _then; /// Create a copy of PollValidationError /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') - @override $Res call({ - Object? maxVotesAllowed = null, + Object? options = null, Object? range = null, }) { - return _then(_$PollValidationErrorMaxVotesAllowedImpl( - null == maxVotesAllowed - ? _value.maxVotesAllowed - : maxVotesAllowed // ignore: cast_nullable_to_non_nullable - as int, + return _then(_PollValidationErrorOptionsRange( + null == options + ? _self._options + : options // ignore: cast_nullable_to_non_nullable + as List, range: null == range - ? _value.range + ? _self.range : range // ignore: cast_nullable_to_non_nullable - as ({int? max, int? min}), + as Range, )); } } /// @nodoc -class _$PollValidationErrorMaxVotesAllowedImpl - implements _PollValidationErrorMaxVotesAllowed { - const _$PollValidationErrorMaxVotesAllowedImpl(this.maxVotesAllowed, +class _PollValidationErrorMaxVotesAllowed implements PollValidationError { + const _PollValidationErrorMaxVotesAllowed(this.maxVotesAllowed, {required this.range}); - @override final int maxVotesAllowed; - @override - final ({int? max, int? min}) range; + final Range range; - @override - String toString() { - return 'PollValidationError.maxVotesAllowed(maxVotesAllowed: $maxVotesAllowed, range: $range)'; - } + /// Create a copy of PollValidationError + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PollValidationErrorMaxVotesAllowedCopyWith< + _PollValidationErrorMaxVotesAllowed> + get copyWith => __$PollValidationErrorMaxVotesAllowedCopyWithImpl< + _PollValidationErrorMaxVotesAllowed>(this, _$identity); @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PollValidationErrorMaxVotesAllowedImpl && + other is _PollValidationErrorMaxVotesAllowed && (identical(other.maxVotesAllowed, maxVotesAllowed) || other.maxVotesAllowed == maxVotesAllowed) && (identical(other.range, range) || other.range == range)); @@ -739,119 +296,49 @@ class _$PollValidationErrorMaxVotesAllowedImpl @override int get hashCode => Object.hash(runtimeType, maxVotesAllowed, range); - /// Create a copy of PollValidationError - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PollValidationErrorMaxVotesAllowedImplCopyWith< - _$PollValidationErrorMaxVotesAllowedImpl> - get copyWith => __$$PollValidationErrorMaxVotesAllowedImplCopyWithImpl< - _$PollValidationErrorMaxVotesAllowedImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(List options) duplicateOptions, - required TResult Function(String name, ({int? max, int? min}) range) - nameRange, - required TResult Function( - List options, ({int? max, int? min}) range) - optionsRange, - required TResult Function(int maxVotesAllowed, ({int? max, int? min}) range) - maxVotesAllowed, - }) { - return maxVotesAllowed(this.maxVotesAllowed, range); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(List options)? duplicateOptions, - TResult? Function(String name, ({int? max, int? min}) range)? nameRange, - TResult? Function(List options, ({int? max, int? min}) range)? - optionsRange, - TResult? Function(int maxVotesAllowed, ({int? max, int? min}) range)? - maxVotesAllowed, - }) { - return maxVotesAllowed?.call(this.maxVotesAllowed, range); - } - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(List options)? duplicateOptions, - TResult Function(String name, ({int? max, int? min}) range)? nameRange, - TResult Function(List options, ({int? max, int? min}) range)? - optionsRange, - TResult Function(int maxVotesAllowed, ({int? max, int? min}) range)? - maxVotesAllowed, - required TResult orElse(), - }) { - if (maxVotesAllowed != null) { - return maxVotesAllowed(this.maxVotesAllowed, range); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_PollValidationErrorDuplicateOptions value) - duplicateOptions, - required TResult Function(_PollValidationErrorNameRange value) nameRange, - required TResult Function(_PollValidationErrorOptionsRange value) - optionsRange, - required TResult Function(_PollValidationErrorMaxVotesAllowed value) - maxVotesAllowed, - }) { - return maxVotesAllowed(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_PollValidationErrorDuplicateOptions value)? - duplicateOptions, - TResult? Function(_PollValidationErrorNameRange value)? nameRange, - TResult? Function(_PollValidationErrorOptionsRange value)? optionsRange, - TResult? Function(_PollValidationErrorMaxVotesAllowed value)? - maxVotesAllowed, - }) { - return maxVotesAllowed?.call(this); + String toString() { + return 'PollValidationError.maxVotesAllowed(maxVotesAllowed: $maxVotesAllowed, range: $range)'; } +} - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_PollValidationErrorDuplicateOptions value)? - duplicateOptions, - TResult Function(_PollValidationErrorNameRange value)? nameRange, - TResult Function(_PollValidationErrorOptionsRange value)? optionsRange, - TResult Function(_PollValidationErrorMaxVotesAllowed value)? - maxVotesAllowed, - required TResult orElse(), - }) { - if (maxVotesAllowed != null) { - return maxVotesAllowed(this); - } - return orElse(); - } +/// @nodoc +abstract mixin class _$PollValidationErrorMaxVotesAllowedCopyWith<$Res> + implements $PollValidationErrorCopyWith<$Res> { + factory _$PollValidationErrorMaxVotesAllowedCopyWith( + _PollValidationErrorMaxVotesAllowed value, + $Res Function(_PollValidationErrorMaxVotesAllowed) _then) = + __$PollValidationErrorMaxVotesAllowedCopyWithImpl; + @useResult + $Res call({int maxVotesAllowed, Range range}); } -abstract class _PollValidationErrorMaxVotesAllowed - implements PollValidationError { - const factory _PollValidationErrorMaxVotesAllowed(final int maxVotesAllowed, - {required final ({int? max, int? min}) range}) = - _$PollValidationErrorMaxVotesAllowedImpl; +/// @nodoc +class __$PollValidationErrorMaxVotesAllowedCopyWithImpl<$Res> + implements _$PollValidationErrorMaxVotesAllowedCopyWith<$Res> { + __$PollValidationErrorMaxVotesAllowedCopyWithImpl(this._self, this._then); - int get maxVotesAllowed; - ({int? max, int? min}) get range; + final _PollValidationErrorMaxVotesAllowed _self; + final $Res Function(_PollValidationErrorMaxVotesAllowed) _then; /// Create a copy of PollValidationError /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PollValidationErrorMaxVotesAllowedImplCopyWith< - _$PollValidationErrorMaxVotesAllowedImpl> - get copyWith => throw _privateConstructorUsedError; + @pragma('vm:prefer-inline') + $Res call({ + Object? maxVotesAllowed = null, + Object? range = null, + }) { + return _then(_PollValidationErrorMaxVotesAllowed( + null == maxVotesAllowed + ? _self.maxVotesAllowed + : maxVotesAllowed // ignore: cast_nullable_to_non_nullable + as int, + range: null == range + ? _self.range + : range // ignore: cast_nullable_to_non_nullable + as Range, + )); + } } + +// dart format on diff --git a/packages/stream_chat_flutter_core/lib/stream_chat_flutter_core.dart b/packages/stream_chat_flutter_core/lib/stream_chat_flutter_core.dart index ebfa497f0f..9c1ce21d13 100644 --- a/packages/stream_chat_flutter_core/lib/stream_chat_flutter_core.dart +++ b/packages/stream_chat_flutter_core/lib/stream_chat_flutter_core.dart @@ -8,7 +8,11 @@ export 'src/lazy_load_scroll_view.dart'; export 'src/message_list_core.dart' hide MessageListCoreState; export 'src/message_text_field_controller.dart'; export 'src/paged_value_notifier.dart' - show PagedValueListenableBuilder, PagedValue, PagedValueNotifier; + show + PagedValueListenableBuilder, + PagedValue, + PagedValueNotifier, + PagedValuePatternMatching; export 'src/paged_value_scroll_view.dart'; export 'src/stream_channel.dart'; export 'src/stream_channel_list_controller.dart'; diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index f9c077bfbd..615661b45d 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -27,7 +27,7 @@ dependencies: device_info_plus: ">=10.1.2 <12.0.0" flutter: sdk: flutter - freezed_annotation: ^2.4.1 + freezed_annotation: ^3.0.0 meta: ^1.9.1 package_info_plus: ^8.3.0 rxdart: ^0.28.0 @@ -38,6 +38,6 @@ dev_dependencies: fake_async: ^1.3.1 flutter_test: sdk: flutter - freezed: ^2.4.2 + freezed: ^3.0.6 mocktail: ^1.0.0 diff --git a/sample_app/ios/Runner.xcodeproj/project.pbxproj b/sample_app/ios/Runner.xcodeproj/project.pbxproj index b433577f9b..2b3de5b647 100644 --- a/sample_app/ios/Runner.xcodeproj/project.pbxproj +++ b/sample_app/ios/Runner.xcodeproj/project.pbxproj @@ -295,8 +295,7 @@ "${BUILT_PRODUCTS_DIR}/package_info_plus/package_info_plus.framework", "${BUILT_PRODUCTS_DIR}/path_provider_foundation/path_provider_foundation.framework", "${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework", - "${BUILT_PRODUCTS_DIR}/record_darwin/record_darwin.framework", - "${BUILT_PRODUCTS_DIR}/screen_brightness_ios/screen_brightness_ios.framework", + "${BUILT_PRODUCTS_DIR}/record_ios/record_ios.framework", "${BUILT_PRODUCTS_DIR}/sentry_flutter/sentry_flutter.framework", "${BUILT_PRODUCTS_DIR}/share_plus/share_plus.framework", "${BUILT_PRODUCTS_DIR}/shared_preferences_foundation/shared_preferences_foundation.framework", @@ -340,8 +339,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info_plus.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_foundation.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/record_darwin.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/screen_brightness_ios.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/record_ios.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sentry_flutter.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share_plus.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences_foundation.framework", From 23f305146f033f2e6a312822ababe1318fa7c88b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 7 May 2025 14:46:45 +0200 Subject: [PATCH 2/9] chore: use range for freezed --- melos.yaml | 4 +- packages/stream_chat/pubspec.yaml | 4 +- .../stream_chat_flutter_core/pubspec.yaml | 4 +- pubspec.lock | 101 +++++++----------- 4 files changed, 46 insertions(+), 67 deletions(-) diff --git a/melos.yaml b/melos.yaml index 8db2a0c9b8..fe95ad7085 100644 --- a/melos.yaml +++ b/melos.yaml @@ -49,7 +49,7 @@ command: flutter_secure_storage: ^9.2.2 flutter_slidable: ^3.1.1 flutter_svg: ^2.0.10+1 - freezed_annotation: ^3.0.0 + freezed_annotation: ">=2.4.1 <4.0.0" gal: ^2.3.1 get_thumbnail_video: ^0.7.3 go_router: ^14.6.2 @@ -102,7 +102,7 @@ command: fake_async: ^1.3.1 faker_dart: ^0.2.1 flutter_launcher_icons: ^0.14.2 - freezed: ^3.0.6 + freezed: ">=2.4.2 <3.0.6" json_serializable: ^6.7.1 mocktail: ^1.0.0 path: ^1.8.3 diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index 5d170643d6..64b73af9df 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: collection: ^1.17.2 dio: ^5.4.3+1 equatable: ^2.0.5 - freezed_annotation: ^3.0.0 + freezed_annotation: ">=2.4.1 <4.0.0" http_parser: ^4.0.2 jose: ^0.3.4 json_annotation: ^4.9.0 @@ -40,7 +40,7 @@ dependencies: dev_dependencies: build_runner: ^2.4.9 - freezed: ^3.0.6 + freezed: ">=2.4.2 <3.0.6" json_serializable: ^6.7.1 mocktail: ^1.0.0 test: ^1.24.6 diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index 615661b45d..09d8899a75 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -27,7 +27,7 @@ dependencies: device_info_plus: ">=10.1.2 <12.0.0" flutter: sdk: flutter - freezed_annotation: ^3.0.0 + freezed_annotation: ">=2.4.1 <4.0.0" meta: ^1.9.1 package_info_plus: ^8.3.0 rxdart: ^0.28.0 @@ -38,6 +38,6 @@ dev_dependencies: fake_async: ^1.3.1 flutter_test: sdk: flutter - freezed: ^3.0.6 + freezed: ">=2.4.2 <3.0.6" mocktail: ^1.0.0 diff --git a/pubspec.lock b/pubspec.lock index 9dc9fc49b3..9eed33197b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,23 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "03f6da266a27a4538a69295ec142cb5717d7d4e5727b84658b63e1e1509bac9c" + sha256: e55636ed79578b9abca5fecf9437947798f5ef7456308b5cb85720b793eac92f url: "https://pub.dev" source: hosted - version: "79.0.0" - _macros: - dependency: transitive - description: dart - source: sdk - version: "0.3.3" + version: "82.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: c9040fc56483c22a5e04a9f6a251313118b1a3c42423770623128fa484115643 + sha256: "13c1e6c6fd460522ea840abec3f677cc226f5fec7872c04ad7b425517ccf54f7" url: "https://pub.dev" source: hosted - version: "7.2.0" + version: "7.4.4" ansi_styles: dependency: transitive description: @@ -34,18 +29,18 @@ packages: dependency: transitive description: name: args - sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.7.0" async: dependency: transitive description: name: async - sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" url: "https://pub.dev" source: hosted - version: "2.12.0" + version: "2.13.0" boolean_selector: dependency: transitive description: @@ -66,10 +61,10 @@ packages: dependency: transitive description: name: built_value - sha256: "28a712df2576b63c6c005c465989a348604960c0958d28be5303ba9baa841ac2" + sha256: ea90e81dc4a25a043d9bee692d20ed6d1c4a1662a28c03a96417446c093ed6b4 url: "https://pub.dev" source: hosted - version: "8.9.3" + version: "8.9.5" charcode: dependency: transitive description: @@ -78,6 +73,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" cli_launcher: dependency: transitive description: @@ -122,10 +125,10 @@ packages: dependency: transitive description: name: conventional_commit - sha256: dec15ad1118f029c618651a4359eb9135d8b88f761aa24e4016d061cd45948f2 + sha256: fad254feb6fb8eace2be18855176b0a4b97e0d50e416ff0fe590d5ba83735d34 url: "https://pub.dev" source: hosted - version: "0.6.0+1" + version: "0.6.1" convert: dependency: transitive description: @@ -170,10 +173,10 @@ packages: dependency: transitive description: name: glob - sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" graphs: dependency: transitive description: @@ -186,18 +189,18 @@ packages: dependency: transitive description: name: http - sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "1.4.0" http_parser: dependency: transitive description: name: http_parser - sha256: "76d306a1c3afb33fe82e2bbacad62a61f409b5634c915fceb0d799de1a913360" + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" url: "https://pub.dev" source: hosted - version: "4.1.1" + version: "4.1.2" intl: dependency: transitive description: @@ -222,14 +225,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.9.0" - macros: - dependency: transitive - description: - name: macros - sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" - url: "https://pub.dev" - source: hosted - version: "0.1.3-main.0" matcher: dependency: transitive description: @@ -242,10 +237,10 @@ packages: dependency: "direct dev" description: name: melos - sha256: a62abfa8c7826cec927f8585572bb9adf591be152150494d879ca2c75118809d + sha256: "3f3ab3f902843d1e5a1b1a4dd39a4aca8ba1056f2d32fd8995210fa2843f646f" url: "https://pub.dev" source: hosted - version: "6.2.0" + version: "6.3.2" meta: dependency: transitive description: @@ -266,10 +261,10 @@ packages: dependency: transitive description: name: package_config - sha256: "92d4488434b520a62570293fbd33bb556c7d49230791c1b4bbd973baf6d2dc67" + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.2.0" path: dependency: "direct dev" description: @@ -314,10 +309,10 @@ packages: dependency: transitive description: name: pub_semver - sha256: "7b3cfbf654f3edd0c6298ecd5be782ce997ddf0e00531b9464b55245185bbbbd" + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "2.2.0" pub_updater: dependency: transitive description: @@ -326,22 +321,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.0" - pubspec: - dependency: transitive - description: - name: pubspec - sha256: f534a50a2b4d48dc3bc0ec147c8bd7c304280fff23b153f3f11803c4d49d927e - url: "https://pub.dev" - source: hosted - version: "2.3.0" - quiver: + pubspec_parse: dependency: transitive description: - name: quiver - sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2 + name: pubspec_parse + sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" url: "https://pub.dev" source: hosted - version: "3.2.2" + version: "1.5.0" recase: dependency: "direct dev" description: @@ -370,10 +357,10 @@ packages: dependency: transitive description: name: stream_channel - sha256: "4ac0537115a24d772c408a2520ecd0abb99bca2ea9c4e634ccbdbfae64fe17ec" + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" string_scanner: dependency: transitive description: @@ -406,14 +393,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" - uri: - dependency: transitive - description: - name: uri - sha256: "889eea21e953187c6099802b7b4cf5219ba8f3518f604a1033064d45b1b8268a" - url: "https://pub.dev" - source: hosted - version: "1.0.0" watcher: dependency: transitive description: @@ -426,10 +405,10 @@ packages: dependency: transitive description: name: web - sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" yaml: dependency: "direct dev" description: From f827f66ce052ff6e807f1823d9efe94889c6058b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 7 May 2025 14:52:08 +0200 Subject: [PATCH 3/9] Apply suggestions from code review --- melos.yaml | 2 +- packages/stream_chat/pubspec.yaml | 2 +- packages/stream_chat_flutter_core/pubspec.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/melos.yaml b/melos.yaml index fe95ad7085..b8a6454522 100644 --- a/melos.yaml +++ b/melos.yaml @@ -102,7 +102,7 @@ command: fake_async: ^1.3.1 faker_dart: ^0.2.1 flutter_launcher_icons: ^0.14.2 - freezed: ">=2.4.2 <3.0.6" + freezed: ">=2.4.2 <4.0.0" json_serializable: ^6.7.1 mocktail: ^1.0.0 path: ^1.8.3 diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index 64b73af9df..059b33d611 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -40,7 +40,7 @@ dependencies: dev_dependencies: build_runner: ^2.4.9 - freezed: ">=2.4.2 <3.0.6" + freezed: ">=2.4.2 <4.0.0" json_serializable: ^6.7.1 mocktail: ^1.0.0 test: ^1.24.6 diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index 09d8899a75..6aed017c19 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -38,6 +38,6 @@ dev_dependencies: fake_async: ^1.3.1 flutter_test: sdk: flutter - freezed: ">=2.4.2 <3.0.6" + freezed: ">=2.4.2 <4.0.0" mocktail: ^1.0.0 From aa84611ff9c781bd037bac85f5a0d18d983a5826 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 7 May 2025 14:55:23 +0200 Subject: [PATCH 4/9] chore: fix formatting --- packages/stream_chat/lib/src/core/models/message_state.dart | 2 +- packages/stream_chat/lib/src/core/models/poll_voting_mode.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/stream_chat/lib/src/core/models/message_state.dart b/packages/stream_chat/lib/src/core/models/message_state.dart index eccfe3345f..0cbefec15b 100644 --- a/packages/stream_chat/lib/src/core/models/message_state.dart +++ b/packages/stream_chat/lib/src/core/models/message_state.dart @@ -710,4 +710,4 @@ extension FailedStatePatternMatching on FailedState { } } -// coverage:ignore-end \ No newline at end of file +// coverage:ignore-end diff --git a/packages/stream_chat/lib/src/core/models/poll_voting_mode.dart b/packages/stream_chat/lib/src/core/models/poll_voting_mode.dart index 9be03c10bc..30334cc7a4 100644 --- a/packages/stream_chat/lib/src/core/models/poll_voting_mode.dart +++ b/packages/stream_chat/lib/src/core/models/poll_voting_mode.dart @@ -154,4 +154,4 @@ extension PollVotingModePatternMatching on PollVotingMode { } } -// coverage:ignore-end \ No newline at end of file +// coverage:ignore-end From f84b0316143f34daff957bcb58f0466073cf14bf Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 7 May 2025 15:12:22 +0200 Subject: [PATCH 5/9] chore(ui): bump desktop_drop --- melos.yaml | 2 +- packages/stream_chat_flutter/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/melos.yaml b/melos.yaml index b8a6454522..909bc5aa21 100644 --- a/melos.yaml +++ b/melos.yaml @@ -31,7 +31,7 @@ command: connectivity_plus: ^6.0.3 contextmenu: ^3.0.0 cupertino_icons: ^1.0.3 - desktop_drop: ^0.5.0 + desktop_drop: '>=0.5.0 <0.7.0' device_info_plus: '>=10.1.2 <12.0.0' diacritic: ^0.1.5 dio: ^5.4.3+1 diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 04dd7d6b08..f4ce9cba3e 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -26,7 +26,7 @@ dependencies: chewie: ^1.8.1 collection: ^1.17.2 contextmenu: ^3.0.0 - desktop_drop: ^0.5.0 + desktop_drop: ">=0.5.0 <0.7.0" diacritic: ^0.1.5 dio: ^5.4.3+1 ezanimation: ^0.6.0 From 8d8774c36b91ba0f6275ff7ab223302c774e9d0b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 7 May 2025 15:25:44 +0200 Subject: [PATCH 6/9] chore: update CHANGELOG.md --- packages/stream_chat/CHANGELOG.md | 6 ++++++ packages/stream_chat_flutter/CHANGELOG.md | 8 ++++++++ packages/stream_chat_flutter_core/CHANGELOG.md | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index a92d19da56..ee657b1d33 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -1,3 +1,9 @@ +## Upcoming + +🔄 Changed + +- Updated `freezed_annotation` dependency to `">=2.4.1 <4.0.0"`. + ## 9.9.0 ✅ Added diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 1d309268bb..3cbb5d9b95 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -1,3 +1,11 @@ +## Upcoming + +🔄 Changed + +- Updated `just_audio` dependency to `">=0.9.38 <0.11.0"`. +- Updated `share_plus` dependency to `^11.0.0`. +- Updated `desktop_drop` dependency to `">=0.5.0 <0.7.0"`. + ## 9.9.0 ✅ Added diff --git a/packages/stream_chat_flutter_core/CHANGELOG.md b/packages/stream_chat_flutter_core/CHANGELOG.md index 7013564867..6cbd44fade 100644 --- a/packages/stream_chat_flutter_core/CHANGELOG.md +++ b/packages/stream_chat_flutter_core/CHANGELOG.md @@ -1,3 +1,9 @@ +## Upcoming + +🔄 Changed + +- Updated `freezed_annotation` dependency to `">=2.4.1 <4.0.0"`. + ## 9.9.0 ✅ Added From 1f4ea6e6a82e4ebbc0a75dcea37c1ec78e7904b6 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 7 May 2025 17:31:14 +0200 Subject: [PATCH 7/9] chore: revert updating just_audio due an issue --- melos.yaml | 2 +- .../lib/src/audio/audio_playlist_controller.dart | 5 ++--- packages/stream_chat_flutter/pubspec.yaml | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/melos.yaml b/melos.yaml index 909bc5aa21..1f2e46e360 100644 --- a/melos.yaml +++ b/melos.yaml @@ -59,7 +59,7 @@ command: jiffy: ^6.2.1 jose: ^0.3.4 json_annotation: ^4.9.0 - just_audio: ">=0.9.38 <0.11.0" + just_audio: ^0.9.38 logging: ^1.2.0 lottie: ^3.1.2 media_kit: ^1.1.10+1 diff --git a/packages/stream_chat_flutter/lib/src/audio/audio_playlist_controller.dart b/packages/stream_chat_flutter/lib/src/audio/audio_playlist_controller.dart index 2e8f13f5a1..013aadde1e 100644 --- a/packages/stream_chat_flutter/lib/src/audio/audio_playlist_controller.dart +++ b/packages/stream_chat_flutter/lib/src/audio/audio_playlist_controller.dart @@ -12,7 +12,6 @@ class StreamAudioPlaylistController extends ValueNotifier { /// {@macro streamAudioPlaylistController} factory StreamAudioPlaylistController(List tracks) { return StreamAudioPlaylistController.raw( - player: AudioPlayer(), state: AudioPlaylistState(tracks: tracks), ); } @@ -20,9 +19,9 @@ class StreamAudioPlaylistController extends ValueNotifier { /// {@macro streamAudioPlaylistController} @visibleForTesting StreamAudioPlaylistController.raw({ - required AudioPlayer player, + AudioPlayer? player, AudioPlaylistState state = const AudioPlaylistState(tracks: []), - }) : _player = player, + }) : _player = player ?? AudioPlayer(), super(state); final AudioPlayer _player; diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index f4ce9cba3e..23dd62a793 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -43,7 +43,7 @@ dependencies: image_picker: ^1.1.2 image_size_getter: ^2.3.0 jiffy: ^6.2.1 - just_audio: ">=0.9.38 <0.11.0" + just_audio: ^0.9.38 lottie: ^3.1.2 media_kit: ^1.1.10+1 media_kit_video: ^1.2.4 From 33af6cda80f99542dce5b9d36d9a4df35900abee Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 7 May 2025 17:31:41 +0200 Subject: [PATCH 8/9] chore: revert just_audio changelog update --- packages/stream_chat_flutter/CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 3cbb5d9b95..ec40b227e5 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -2,7 +2,6 @@ 🔄 Changed -- Updated `just_audio` dependency to `">=0.9.38 <0.11.0"`. - Updated `share_plus` dependency to `^11.0.0`. - Updated `desktop_drop` dependency to `">=0.5.0 <0.7.0"`. From a28f9eb704d430191ab816009bfe59ae060b9bff Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 7 May 2025 19:18:18 +0200 Subject: [PATCH 9/9] chore: fix ignore coverage --- .../stream_chat_flutter_core/lib/src/paged_value_notifier.dart | 2 +- .../lib/src/stream_poll_controller.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart index bcf932b64b..661e58c817 100644 --- a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart +++ b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart @@ -263,4 +263,4 @@ extension PagedValuePatternMatching on PagedValue { } } -// coverage:ignore-start +// coverage:ignore-end diff --git a/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart index ee3643a4dd..749fb77e0e 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_poll_controller.dart @@ -415,4 +415,4 @@ extension PollValidationErrorPatternMatching on PollValidationError { } } -// coverage:ignore-start +// coverage:ignore-end