Files
cutdex/lib/features/projects/conversation_sidebar.freezed.dart
T
lingjhf 27e77fff39 feat: initial Cutdex application
Add the Flutter video editing application with project management, media
import, timeline editing, preview, AI assistance, diagnostics and settings.

Include shared UI and native host packages, platform runners, application
tests and release tooling.

Provide usage and contribution guides, the MIT license and third-party
notices. Exclude local credentials, build outputs and validation data.
2026-10-05 23:36:23 +08:00

1169 lines
33 KiB
Dart

// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint, type=warning, deprecated_member_use, deprecated_member_use_from_same_package
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'conversation_sidebar.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// GENERATED CODE - DO NOT MODIFY BY HAND
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ConversationSnapshot {
String? get projectId;
Map<String, List<ConversationMetadata>> get groups;
List<ConversationMetadata> get trashed;
String? get selectedId;
bool get reloadFailed;
/// Create a copy of ConversationSnapshot
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ConversationSnapshotCopyWith<ConversationSnapshot> get copyWith =>
_$ConversationSnapshotCopyWithImpl<ConversationSnapshot>(
this as ConversationSnapshot,
_$identity,
);
@override
bool operator ==(Object other) {
final _this = this as ConversationSnapshot;
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is ConversationSnapshot &&
(identical(other.projectId, _this.projectId) ||
other.projectId == _this.projectId) &&
const DeepCollectionEquality().equals(other.groups, _this.groups) &&
const DeepCollectionEquality().equals(
other.trashed,
_this.trashed,
) &&
(identical(other.selectedId, _this.selectedId) ||
other.selectedId == _this.selectedId) &&
(identical(other.reloadFailed, _this.reloadFailed) ||
other.reloadFailed == _this.reloadFailed));
}
@override
int get hashCode {
final _this = this as ConversationSnapshot;
return Object.hash(
runtimeType,
_this.projectId,
const DeepCollectionEquality().hash(_this.groups),
const DeepCollectionEquality().hash(_this.trashed),
_this.selectedId,
_this.reloadFailed,
);
}
@override
String toString() {
final _this = this as ConversationSnapshot;
return 'ConversationSnapshot(projectId: ${_this.projectId}, groups: ${_this.groups}, trashed: ${_this.trashed}, selectedId: ${_this.selectedId}, reloadFailed: ${_this.reloadFailed})';
}
}
/// @nodoc
abstract mixin class $ConversationSnapshotCopyWith<$Res> {
factory $ConversationSnapshotCopyWith(
ConversationSnapshot value,
$Res Function(ConversationSnapshot) _then,
) = _$ConversationSnapshotCopyWithImpl;
@useResult
$Res call({
String? projectId,
Map<String, List<ConversationMetadata>> groups,
List<ConversationMetadata> trashed,
String? selectedId,
bool reloadFailed,
});
}
/// @nodoc
class _$ConversationSnapshotCopyWithImpl<$Res>
implements $ConversationSnapshotCopyWith<$Res> {
_$ConversationSnapshotCopyWithImpl(this._self, this._then);
final ConversationSnapshot _self;
final $Res Function(ConversationSnapshot) _then;
/// Create a copy of ConversationSnapshot
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? projectId = freezed,
Object? groups = null,
Object? trashed = null,
Object? selectedId = freezed,
Object? reloadFailed = null,
}) {
return _then(
ConversationSnapshot(
projectId: freezed == projectId
? _self.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
groups: null == groups
? _self.groups
: groups // ignore: cast_nullable_to_non_nullable
as Map<String, List<ConversationMetadata>>,
trashed: null == trashed
? _self.trashed
: trashed // ignore: cast_nullable_to_non_nullable
as List<ConversationMetadata>,
selectedId: freezed == selectedId
? _self.selectedId
: selectedId // ignore: cast_nullable_to_non_nullable
as String?,
reloadFailed: null == reloadFailed
? _self.reloadFailed
: reloadFailed // ignore: cast_nullable_to_non_nullable
as bool,
),
);
}
}
/// Adds pattern-matching-related methods to [ConversationSnapshot].
extension ConversationSnapshotPatterns on ConversationSnapshot {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_ConversationSnapshot value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _ConversationSnapshot() when $default != null:
return $default(_that);
case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_ConversationSnapshot value) $default,
) {
final _that = this;
switch (_that) {
case _ConversationSnapshot():
return $default(_that);
case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_ConversationSnapshot value)? $default,
) {
final _that = this;
switch (_that) {
case _ConversationSnapshot() when $default != null:
return $default(_that);
case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function(
String? projectId,
Map<String, List<ConversationMetadata>> groups,
List<ConversationMetadata> trashed,
String? selectedId,
bool reloadFailed,
)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _ConversationSnapshot() when $default != null:
return $default(
_that.projectId,
_that.groups,
_that.trashed,
_that.selectedId,
_that.reloadFailed,
);
case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function(
String? projectId,
Map<String, List<ConversationMetadata>> groups,
List<ConversationMetadata> trashed,
String? selectedId,
bool reloadFailed,
)
$default,
) {
final _that = this;
switch (_that) {
case _ConversationSnapshot():
return $default(
_that.projectId,
_that.groups,
_that.trashed,
_that.selectedId,
_that.reloadFailed,
);
case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function(
String? projectId,
Map<String, List<ConversationMetadata>> groups,
List<ConversationMetadata> trashed,
String? selectedId,
bool reloadFailed,
)?
$default,
) {
final _that = this;
switch (_that) {
case _ConversationSnapshot() when $default != null:
return $default(
_that.projectId,
_that.groups,
_that.trashed,
_that.selectedId,
_that.reloadFailed,
);
case _:
return null;
}
}
}
/// @nodoc
class _ConversationSnapshot implements ConversationSnapshot {
const _ConversationSnapshot({
this.projectId,
Map<String, List<ConversationMetadata>> groups = const {},
List<ConversationMetadata> trashed = const [],
this.selectedId,
this.reloadFailed = false,
}) : _groups = groups,
_trashed = trashed;
@override
final String? projectId;
final Map<String, List<ConversationMetadata>> _groups;
@override
@JsonKey()
Map<String, List<ConversationMetadata>> get groups {
if (_groups is EqualUnmodifiableMapView) return _groups;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_groups);
}
final List<ConversationMetadata> _trashed;
@override
@JsonKey()
List<ConversationMetadata> get trashed {
if (_trashed is EqualUnmodifiableListView) return _trashed;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_trashed);
}
@override
final String? selectedId;
@override
@JsonKey()
final bool reloadFailed;
/// Create a copy of ConversationSnapshot
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ConversationSnapshotCopyWith<_ConversationSnapshot> get copyWith =>
__$ConversationSnapshotCopyWithImpl<_ConversationSnapshot>(
this,
_$identity,
);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _ConversationSnapshot &&
(identical(other.projectId, projectId) ||
other.projectId == projectId) &&
const DeepCollectionEquality().equals(other.groups, _groups) &&
const DeepCollectionEquality().equals(other.trashed, _trashed) &&
(identical(other.selectedId, selectedId) ||
other.selectedId == selectedId) &&
(identical(other.reloadFailed, reloadFailed) ||
other.reloadFailed == reloadFailed));
}
@override
int get hashCode {
return Object.hash(
runtimeType,
projectId,
const DeepCollectionEquality().hash(_groups),
const DeepCollectionEquality().hash(_trashed),
selectedId,
reloadFailed,
);
}
@override
String toString() {
return 'ConversationSnapshot(projectId: $projectId, groups: $groups, trashed: $trashed, selectedId: $selectedId, reloadFailed: $reloadFailed)';
}
}
/// @nodoc
abstract mixin class _$ConversationSnapshotCopyWith<$Res>
implements $ConversationSnapshotCopyWith<$Res> {
factory _$ConversationSnapshotCopyWith(
_ConversationSnapshot value,
$Res Function(_ConversationSnapshot) _then,
) = __$ConversationSnapshotCopyWithImpl;
@override
@useResult
$Res call({
String? projectId,
Map<String, List<ConversationMetadata>> groups,
List<ConversationMetadata> trashed,
String? selectedId,
bool reloadFailed,
});
}
/// @nodoc
class __$ConversationSnapshotCopyWithImpl<$Res>
implements _$ConversationSnapshotCopyWith<$Res> {
__$ConversationSnapshotCopyWithImpl(this._self, this._then);
final _ConversationSnapshot _self;
final $Res Function(_ConversationSnapshot) _then;
/// Create a copy of ConversationSnapshot
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? projectId = freezed,
Object? groups = null,
Object? trashed = null,
Object? selectedId = freezed,
Object? reloadFailed = null,
}) {
return _then(
_ConversationSnapshot(
projectId: freezed == projectId
? _self.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
groups: null == groups
? _self._groups
: groups // ignore: cast_nullable_to_non_nullable
as Map<String, List<ConversationMetadata>>,
trashed: null == trashed
? _self._trashed
: trashed // ignore: cast_nullable_to_non_nullable
as List<ConversationMetadata>,
selectedId: freezed == selectedId
? _self.selectedId
: selectedId // ignore: cast_nullable_to_non_nullable
as String?,
reloadFailed: null == reloadFailed
? _self.reloadFailed
: reloadFailed // ignore: cast_nullable_to_non_nullable
as bool,
),
);
}
}
/// @nodoc
mixin _$ConversationWorkspaceKey {
String? get projectId;
List<String> get projectIds;
/// Create a copy of ConversationWorkspaceKey
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ConversationWorkspaceKeyCopyWith<ConversationWorkspaceKey> get copyWith =>
_$ConversationWorkspaceKeyCopyWithImpl<ConversationWorkspaceKey>(
this as ConversationWorkspaceKey,
_$identity,
);
@override
bool operator ==(Object other) {
final _this = this as ConversationWorkspaceKey;
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is ConversationWorkspaceKey &&
(identical(other.projectId, _this.projectId) ||
other.projectId == _this.projectId) &&
const DeepCollectionEquality().equals(
other.projectIds,
_this.projectIds,
));
}
@override
int get hashCode {
final _this = this as ConversationWorkspaceKey;
return Object.hash(
runtimeType,
_this.projectId,
const DeepCollectionEquality().hash(_this.projectIds),
);
}
@override
String toString() {
final _this = this as ConversationWorkspaceKey;
return 'ConversationWorkspaceKey(projectId: ${_this.projectId}, projectIds: ${_this.projectIds})';
}
}
/// @nodoc
abstract mixin class $ConversationWorkspaceKeyCopyWith<$Res> {
factory $ConversationWorkspaceKeyCopyWith(
ConversationWorkspaceKey value,
$Res Function(ConversationWorkspaceKey) _then,
) = _$ConversationWorkspaceKeyCopyWithImpl;
@useResult
$Res call({String? projectId, List<String> projectIds});
}
/// @nodoc
class _$ConversationWorkspaceKeyCopyWithImpl<$Res>
implements $ConversationWorkspaceKeyCopyWith<$Res> {
_$ConversationWorkspaceKeyCopyWithImpl(this._self, this._then);
final ConversationWorkspaceKey _self;
final $Res Function(ConversationWorkspaceKey) _then;
/// Create a copy of ConversationWorkspaceKey
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? projectId = freezed, Object? projectIds = null}) {
return _then(
ConversationWorkspaceKey(
projectId: freezed == projectId
? _self.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
projectIds: null == projectIds
? _self.projectIds
: projectIds // ignore: cast_nullable_to_non_nullable
as List<String>,
),
);
}
}
/// Adds pattern-matching-related methods to [ConversationWorkspaceKey].
extension ConversationWorkspaceKeyPatterns on ConversationWorkspaceKey {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_ConversationWorkspaceKey value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _ConversationWorkspaceKey() when $default != null:
return $default(_that);
case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_ConversationWorkspaceKey value) $default,
) {
final _that = this;
switch (_that) {
case _ConversationWorkspaceKey():
return $default(_that);
case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_ConversationWorkspaceKey value)? $default,
) {
final _that = this;
switch (_that) {
case _ConversationWorkspaceKey() when $default != null:
return $default(_that);
case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function(String? projectId, List<String> projectIds)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _ConversationWorkspaceKey() when $default != null:
return $default(_that.projectId, _that.projectIds);
case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function(String? projectId, List<String> projectIds) $default,
) {
final _that = this;
switch (_that) {
case _ConversationWorkspaceKey():
return $default(_that.projectId, _that.projectIds);
case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function(String? projectId, List<String> projectIds)? $default,
) {
final _that = this;
switch (_that) {
case _ConversationWorkspaceKey() when $default != null:
return $default(_that.projectId, _that.projectIds);
case _:
return null;
}
}
}
/// @nodoc
class _ConversationWorkspaceKey implements ConversationWorkspaceKey {
const _ConversationWorkspaceKey({
this.projectId,
required List<String> projectIds,
}) : _projectIds = projectIds;
@override
final String? projectId;
final List<String> _projectIds;
@override
List<String> get projectIds {
if (_projectIds is EqualUnmodifiableListView) return _projectIds;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_projectIds);
}
/// Create a copy of ConversationWorkspaceKey
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ConversationWorkspaceKeyCopyWith<_ConversationWorkspaceKey> get copyWith =>
__$ConversationWorkspaceKeyCopyWithImpl<_ConversationWorkspaceKey>(
this,
_$identity,
);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _ConversationWorkspaceKey &&
(identical(other.projectId, projectId) ||
other.projectId == projectId) &&
const DeepCollectionEquality().equals(
other.projectIds,
_projectIds,
));
}
@override
int get hashCode {
return Object.hash(
runtimeType,
projectId,
const DeepCollectionEquality().hash(_projectIds),
);
}
@override
String toString() {
return 'ConversationWorkspaceKey(projectId: $projectId, projectIds: $projectIds)';
}
}
/// @nodoc
abstract mixin class _$ConversationWorkspaceKeyCopyWith<$Res>
implements $ConversationWorkspaceKeyCopyWith<$Res> {
factory _$ConversationWorkspaceKeyCopyWith(
_ConversationWorkspaceKey value,
$Res Function(_ConversationWorkspaceKey) _then,
) = __$ConversationWorkspaceKeyCopyWithImpl;
@override
@useResult
$Res call({String? projectId, List<String> projectIds});
}
/// @nodoc
class __$ConversationWorkspaceKeyCopyWithImpl<$Res>
implements _$ConversationWorkspaceKeyCopyWith<$Res> {
__$ConversationWorkspaceKeyCopyWithImpl(this._self, this._then);
final _ConversationWorkspaceKey _self;
final $Res Function(_ConversationWorkspaceKey) _then;
/// Create a copy of ConversationWorkspaceKey
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({Object? projectId = freezed, Object? projectIds = null}) {
return _then(
_ConversationWorkspaceKey(
projectId: freezed == projectId
? _self.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
projectIds: null == projectIds
? _self._projectIds
: projectIds // ignore: cast_nullable_to_non_nullable
as List<String>,
),
);
}
}
/// @nodoc
mixin _$ConversationSelectionState {
String? get selectedId;
String get draftKey;
bool get initialized;
/// Create a copy of ConversationSelectionState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ConversationSelectionStateCopyWith<ConversationSelectionState>
get copyWith =>
_$ConversationSelectionStateCopyWithImpl<ConversationSelectionState>(
this as ConversationSelectionState,
_$identity,
);
@override
bool operator ==(Object other) {
final _this = this as ConversationSelectionState;
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is ConversationSelectionState &&
(identical(other.selectedId, _this.selectedId) ||
other.selectedId == _this.selectedId) &&
(identical(other.draftKey, _this.draftKey) ||
other.draftKey == _this.draftKey) &&
(identical(other.initialized, _this.initialized) ||
other.initialized == _this.initialized));
}
@override
int get hashCode {
final _this = this as ConversationSelectionState;
return Object.hash(
runtimeType,
_this.selectedId,
_this.draftKey,
_this.initialized,
);
}
@override
String toString() {
final _this = this as ConversationSelectionState;
return 'ConversationSelectionState(selectedId: ${_this.selectedId}, draftKey: ${_this.draftKey}, initialized: ${_this.initialized})';
}
}
/// @nodoc
abstract mixin class $ConversationSelectionStateCopyWith<$Res> {
factory $ConversationSelectionStateCopyWith(
ConversationSelectionState value,
$Res Function(ConversationSelectionState) _then,
) = _$ConversationSelectionStateCopyWithImpl;
@useResult
$Res call({String? selectedId, String draftKey, bool initialized});
}
/// @nodoc
class _$ConversationSelectionStateCopyWithImpl<$Res>
implements $ConversationSelectionStateCopyWith<$Res> {
_$ConversationSelectionStateCopyWithImpl(this._self, this._then);
final ConversationSelectionState _self;
final $Res Function(ConversationSelectionState) _then;
/// Create a copy of ConversationSelectionState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? selectedId = freezed,
Object? draftKey = null,
Object? initialized = null,
}) {
return _then(
ConversationSelectionState(
selectedId: freezed == selectedId
? _self.selectedId
: selectedId // ignore: cast_nullable_to_non_nullable
as String?,
draftKey: null == draftKey
? _self.draftKey
: draftKey // ignore: cast_nullable_to_non_nullable
as String,
initialized: null == initialized
? _self.initialized
: initialized // ignore: cast_nullable_to_non_nullable
as bool,
),
);
}
}
/// Adds pattern-matching-related methods to [ConversationSelectionState].
extension ConversationSelectionStatePatterns on ConversationSelectionState {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_ConversationSelectionState value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _ConversationSelectionState() when $default != null:
return $default(_that);
case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_ConversationSelectionState value) $default,
) {
final _that = this;
switch (_that) {
case _ConversationSelectionState():
return $default(_that);
case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_ConversationSelectionState value)? $default,
) {
final _that = this;
switch (_that) {
case _ConversationSelectionState() when $default != null:
return $default(_that);
case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function(String? selectedId, String draftKey, bool initialized)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _ConversationSelectionState() when $default != null:
return $default(_that.selectedId, _that.draftKey, _that.initialized);
case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function(String? selectedId, String draftKey, bool initialized)
$default,
) {
final _that = this;
switch (_that) {
case _ConversationSelectionState():
return $default(_that.selectedId, _that.draftKey, _that.initialized);
case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function(String? selectedId, String draftKey, bool initialized)?
$default,
) {
final _that = this;
switch (_that) {
case _ConversationSelectionState() when $default != null:
return $default(_that.selectedId, _that.draftKey, _that.initialized);
case _:
return null;
}
}
}
/// @nodoc
class _ConversationSelectionState implements ConversationSelectionState {
const _ConversationSelectionState({
this.selectedId,
required this.draftKey,
this.initialized = false,
});
@override
final String? selectedId;
@override
final String draftKey;
@override
@JsonKey()
final bool initialized;
/// Create a copy of ConversationSelectionState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ConversationSelectionStateCopyWith<_ConversationSelectionState>
get copyWith =>
__$ConversationSelectionStateCopyWithImpl<_ConversationSelectionState>(
this,
_$identity,
);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _ConversationSelectionState &&
(identical(other.selectedId, selectedId) ||
other.selectedId == selectedId) &&
(identical(other.draftKey, draftKey) ||
other.draftKey == draftKey) &&
(identical(other.initialized, initialized) ||
other.initialized == initialized));
}
@override
int get hashCode {
return Object.hash(runtimeType, selectedId, draftKey, initialized);
}
@override
String toString() {
return 'ConversationSelectionState(selectedId: $selectedId, draftKey: $draftKey, initialized: $initialized)';
}
}
/// @nodoc
abstract mixin class _$ConversationSelectionStateCopyWith<$Res>
implements $ConversationSelectionStateCopyWith<$Res> {
factory _$ConversationSelectionStateCopyWith(
_ConversationSelectionState value,
$Res Function(_ConversationSelectionState) _then,
) = __$ConversationSelectionStateCopyWithImpl;
@override
@useResult
$Res call({String? selectedId, String draftKey, bool initialized});
}
/// @nodoc
class __$ConversationSelectionStateCopyWithImpl<$Res>
implements _$ConversationSelectionStateCopyWith<$Res> {
__$ConversationSelectionStateCopyWithImpl(this._self, this._then);
final _ConversationSelectionState _self;
final $Res Function(_ConversationSelectionState) _then;
/// Create a copy of ConversationSelectionState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? selectedId = freezed,
Object? draftKey = null,
Object? initialized = null,
}) {
return _then(
_ConversationSelectionState(
selectedId: freezed == selectedId
? _self.selectedId
: selectedId // ignore: cast_nullable_to_non_nullable
as String?,
draftKey: null == draftKey
? _self.draftKey
: draftKey // ignore: cast_nullable_to_non_nullable
as String,
initialized: null == initialized
? _self.initialized
: initialized // ignore: cast_nullable_to_non_nullable
as bool,
),
);
}
}