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.
1304 lines
37 KiB
Dart
1304 lines
37 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 'subtitle_download.dart';
|
|
|
|
// **************************************************************************
|
|
// FreezedGenerator
|
|
// **************************************************************************
|
|
|
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
T _$identity<T>(T value) => value;
|
|
|
|
/// @nodoc
|
|
mixin _$SubtitleRequest {
|
|
EditorTimelineSession get session;
|
|
SequenceId? get sequence;
|
|
AssetDocument? get asset;
|
|
TranscriptionClipTarget? get target;
|
|
String get language;
|
|
String get targetLanguage;
|
|
|
|
/// Create a copy of SubtitleRequest
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
@pragma('vm:prefer-inline')
|
|
$SubtitleRequestCopyWith<SubtitleRequest> get copyWith =>
|
|
_$SubtitleRequestCopyWithImpl<SubtitleRequest>(
|
|
this as SubtitleRequest,
|
|
_$identity,
|
|
);
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
final _this = this as SubtitleRequest;
|
|
return identical(this, other) ||
|
|
(other.runtimeType == runtimeType &&
|
|
other is SubtitleRequest &&
|
|
(identical(other.session, _this.session) ||
|
|
other.session == _this.session) &&
|
|
(identical(other.sequence, _this.sequence) ||
|
|
other.sequence == _this.sequence) &&
|
|
(identical(other.asset, _this.asset) ||
|
|
other.asset == _this.asset) &&
|
|
(identical(other.target, _this.target) ||
|
|
other.target == _this.target) &&
|
|
(identical(other.language, _this.language) ||
|
|
other.language == _this.language) &&
|
|
(identical(other.targetLanguage, _this.targetLanguage) ||
|
|
other.targetLanguage == _this.targetLanguage));
|
|
}
|
|
|
|
@override
|
|
int get hashCode {
|
|
final _this = this as SubtitleRequest;
|
|
return Object.hash(
|
|
runtimeType,
|
|
_this.session,
|
|
_this.sequence,
|
|
_this.asset,
|
|
_this.target,
|
|
_this.language,
|
|
_this.targetLanguage,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
final _this = this as SubtitleRequest;
|
|
return 'SubtitleRequest(session: ${_this.session}, sequence: ${_this.sequence}, asset: ${_this.asset}, target: ${_this.target}, language: ${_this.language}, targetLanguage: ${_this.targetLanguage})';
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract mixin class $SubtitleRequestCopyWith<$Res> {
|
|
factory $SubtitleRequestCopyWith(
|
|
SubtitleRequest value,
|
|
$Res Function(SubtitleRequest) _then,
|
|
) = _$SubtitleRequestCopyWithImpl;
|
|
@useResult
|
|
$Res call({
|
|
EditorTimelineSession session,
|
|
SequenceId? sequence,
|
|
AssetDocument? asset,
|
|
TranscriptionClipTarget? target,
|
|
String language,
|
|
String targetLanguage,
|
|
});
|
|
|
|
$TranscriptionClipTargetCopyWith<$Res>? get target;
|
|
}
|
|
|
|
/// @nodoc
|
|
class _$SubtitleRequestCopyWithImpl<$Res>
|
|
implements $SubtitleRequestCopyWith<$Res> {
|
|
_$SubtitleRequestCopyWithImpl(this._self, this._then);
|
|
|
|
final SubtitleRequest _self;
|
|
final $Res Function(SubtitleRequest) _then;
|
|
|
|
/// Create a copy of SubtitleRequest
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@pragma('vm:prefer-inline')
|
|
@override
|
|
$Res call({
|
|
Object? session = null,
|
|
Object? sequence = freezed,
|
|
Object? asset = freezed,
|
|
Object? target = freezed,
|
|
Object? language = null,
|
|
Object? targetLanguage = null,
|
|
}) {
|
|
return _then(
|
|
SubtitleRequest(
|
|
session: null == session
|
|
? _self.session
|
|
: session // ignore: cast_nullable_to_non_nullable
|
|
as EditorTimelineSession,
|
|
sequence: freezed == sequence
|
|
? _self.sequence
|
|
: sequence // ignore: cast_nullable_to_non_nullable
|
|
as SequenceId?,
|
|
asset: freezed == asset
|
|
? _self.asset
|
|
: asset // ignore: cast_nullable_to_non_nullable
|
|
as AssetDocument?,
|
|
target: freezed == target
|
|
? _self.target
|
|
: target // ignore: cast_nullable_to_non_nullable
|
|
as TranscriptionClipTarget?,
|
|
language: null == language
|
|
? _self.language
|
|
: language // ignore: cast_nullable_to_non_nullable
|
|
as String,
|
|
targetLanguage: null == targetLanguage
|
|
? _self.targetLanguage
|
|
: targetLanguage // ignore: cast_nullable_to_non_nullable
|
|
as String,
|
|
),
|
|
);
|
|
}
|
|
|
|
/// Create a copy of SubtitleRequest
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$TranscriptionClipTargetCopyWith<$Res>? get target {
|
|
if (_self.target == null) {
|
|
return null;
|
|
}
|
|
|
|
return $TranscriptionClipTargetCopyWith<$Res>(_self.target!, (value) {
|
|
return _then(_self.copyWith(target: value));
|
|
});
|
|
}
|
|
}
|
|
|
|
/// Adds pattern-matching-related methods to [SubtitleRequest].
|
|
extension SubtitleRequestPatterns on SubtitleRequest {
|
|
/// 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(_SubtitleRequest value)? $default, {
|
|
required TResult orElse(),
|
|
}) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _SubtitleRequest() 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(_SubtitleRequest value) $default,
|
|
) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _SubtitleRequest():
|
|
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(_SubtitleRequest value)? $default,
|
|
) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _SubtitleRequest() 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(
|
|
EditorTimelineSession session,
|
|
SequenceId? sequence,
|
|
AssetDocument? asset,
|
|
TranscriptionClipTarget? target,
|
|
String language,
|
|
String targetLanguage,
|
|
)?
|
|
$default, {
|
|
required TResult orElse(),
|
|
}) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _SubtitleRequest() when $default != null:
|
|
return $default(
|
|
_that.session,
|
|
_that.sequence,
|
|
_that.asset,
|
|
_that.target,
|
|
_that.language,
|
|
_that.targetLanguage,
|
|
);
|
|
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(
|
|
EditorTimelineSession session,
|
|
SequenceId? sequence,
|
|
AssetDocument? asset,
|
|
TranscriptionClipTarget? target,
|
|
String language,
|
|
String targetLanguage,
|
|
)
|
|
$default,
|
|
) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _SubtitleRequest():
|
|
return $default(
|
|
_that.session,
|
|
_that.sequence,
|
|
_that.asset,
|
|
_that.target,
|
|
_that.language,
|
|
_that.targetLanguage,
|
|
);
|
|
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(
|
|
EditorTimelineSession session,
|
|
SequenceId? sequence,
|
|
AssetDocument? asset,
|
|
TranscriptionClipTarget? target,
|
|
String language,
|
|
String targetLanguage,
|
|
)?
|
|
$default,
|
|
) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case _SubtitleRequest() when $default != null:
|
|
return $default(
|
|
_that.session,
|
|
_that.sequence,
|
|
_that.asset,
|
|
_that.target,
|
|
_that.language,
|
|
_that.targetLanguage,
|
|
);
|
|
case _:
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
|
|
class _SubtitleRequest implements SubtitleRequest {
|
|
const _SubtitleRequest({
|
|
required this.session,
|
|
required this.sequence,
|
|
this.asset,
|
|
this.target,
|
|
this.language = 'auto',
|
|
this.targetLanguage = 'none',
|
|
});
|
|
|
|
@override
|
|
final EditorTimelineSession session;
|
|
@override
|
|
final SequenceId? sequence;
|
|
@override
|
|
final AssetDocument? asset;
|
|
@override
|
|
final TranscriptionClipTarget? target;
|
|
@override
|
|
@JsonKey()
|
|
final String language;
|
|
@override
|
|
@JsonKey()
|
|
final String targetLanguage;
|
|
|
|
/// Create a copy of SubtitleRequest
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
@pragma('vm:prefer-inline')
|
|
_$SubtitleRequestCopyWith<_SubtitleRequest> get copyWith =>
|
|
__$SubtitleRequestCopyWithImpl<_SubtitleRequest>(this, _$identity);
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
return identical(this, other) ||
|
|
(other.runtimeType == runtimeType &&
|
|
other is _SubtitleRequest &&
|
|
(identical(other.session, session) || other.session == session) &&
|
|
(identical(other.sequence, sequence) ||
|
|
other.sequence == sequence) &&
|
|
(identical(other.asset, asset) || other.asset == asset) &&
|
|
(identical(other.target, target) || other.target == target) &&
|
|
(identical(other.language, language) ||
|
|
other.language == language) &&
|
|
(identical(other.targetLanguage, targetLanguage) ||
|
|
other.targetLanguage == targetLanguage));
|
|
}
|
|
|
|
@override
|
|
int get hashCode {
|
|
return Object.hash(
|
|
runtimeType,
|
|
session,
|
|
sequence,
|
|
asset,
|
|
target,
|
|
language,
|
|
targetLanguage,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'SubtitleRequest(session: $session, sequence: $sequence, asset: $asset, target: $target, language: $language, targetLanguage: $targetLanguage)';
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract mixin class _$SubtitleRequestCopyWith<$Res>
|
|
implements $SubtitleRequestCopyWith<$Res> {
|
|
factory _$SubtitleRequestCopyWith(
|
|
_SubtitleRequest value,
|
|
$Res Function(_SubtitleRequest) _then,
|
|
) = __$SubtitleRequestCopyWithImpl;
|
|
@override
|
|
@useResult
|
|
$Res call({
|
|
EditorTimelineSession session,
|
|
SequenceId? sequence,
|
|
AssetDocument? asset,
|
|
TranscriptionClipTarget? target,
|
|
String language,
|
|
String targetLanguage,
|
|
});
|
|
|
|
@override
|
|
$TranscriptionClipTargetCopyWith<$Res>? get target;
|
|
}
|
|
|
|
/// @nodoc
|
|
class __$SubtitleRequestCopyWithImpl<$Res>
|
|
implements _$SubtitleRequestCopyWith<$Res> {
|
|
__$SubtitleRequestCopyWithImpl(this._self, this._then);
|
|
|
|
final _SubtitleRequest _self;
|
|
final $Res Function(_SubtitleRequest) _then;
|
|
|
|
/// Create a copy of SubtitleRequest
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$Res call({
|
|
Object? session = null,
|
|
Object? sequence = freezed,
|
|
Object? asset = freezed,
|
|
Object? target = freezed,
|
|
Object? language = null,
|
|
Object? targetLanguage = null,
|
|
}) {
|
|
return _then(
|
|
_SubtitleRequest(
|
|
session: null == session
|
|
? _self.session
|
|
: session // ignore: cast_nullable_to_non_nullable
|
|
as EditorTimelineSession,
|
|
sequence: freezed == sequence
|
|
? _self.sequence
|
|
: sequence // ignore: cast_nullable_to_non_nullable
|
|
as SequenceId?,
|
|
asset: freezed == asset
|
|
? _self.asset
|
|
: asset // ignore: cast_nullable_to_non_nullable
|
|
as AssetDocument?,
|
|
target: freezed == target
|
|
? _self.target
|
|
: target // ignore: cast_nullable_to_non_nullable
|
|
as TranscriptionClipTarget?,
|
|
language: null == language
|
|
? _self.language
|
|
: language // ignore: cast_nullable_to_non_nullable
|
|
as String,
|
|
targetLanguage: null == targetLanguage
|
|
? _self.targetLanguage
|
|
: targetLanguage // ignore: cast_nullable_to_non_nullable
|
|
as String,
|
|
),
|
|
);
|
|
}
|
|
|
|
/// Create a copy of SubtitleRequest
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$TranscriptionClipTargetCopyWith<$Res>? get target {
|
|
if (_self.target == null) {
|
|
return null;
|
|
}
|
|
|
|
return $TranscriptionClipTargetCopyWith<$Res>(_self.target!, (value) {
|
|
return _then(_self.copyWith(target: value));
|
|
});
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
mixin _$SubtitleDownloadState {
|
|
@override
|
|
bool operator ==(Object other) {
|
|
return identical(this, other) ||
|
|
(other.runtimeType == runtimeType && other is SubtitleDownloadState);
|
|
}
|
|
|
|
@override
|
|
int get hashCode => runtimeType.hashCode;
|
|
|
|
@override
|
|
String toString() {
|
|
return 'SubtitleDownloadState()';
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
class $SubtitleDownloadStateCopyWith<$Res> {
|
|
$SubtitleDownloadStateCopyWith(
|
|
SubtitleDownloadState _,
|
|
$Res Function(SubtitleDownloadState) __,
|
|
);
|
|
}
|
|
|
|
/// Adds pattern-matching-related methods to [SubtitleDownloadState].
|
|
extension SubtitleDownloadStatePatterns on SubtitleDownloadState {
|
|
/// 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(SubtitleIdle value)? idle,
|
|
TResult Function(SubtitleStarting value)? starting,
|
|
TResult Function(SubtitleDownloading value)? downloading,
|
|
TResult Function(SubtitleStarted value)? started,
|
|
TResult Function(SubtitleCancelled value)? cancelled,
|
|
TResult Function(SubtitleFailed value)? failed,
|
|
required TResult orElse(),
|
|
}) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case SubtitleIdle() when idle != null:
|
|
return idle(_that);
|
|
case SubtitleStarting() when starting != null:
|
|
return starting(_that);
|
|
case SubtitleDownloading() when downloading != null:
|
|
return downloading(_that);
|
|
case SubtitleStarted() when started != null:
|
|
return started(_that);
|
|
case SubtitleCancelled() when cancelled != null:
|
|
return cancelled(_that);
|
|
case SubtitleFailed() when failed != null:
|
|
return failed(_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?>({
|
|
required TResult Function(SubtitleIdle value) idle,
|
|
required TResult Function(SubtitleStarting value) starting,
|
|
required TResult Function(SubtitleDownloading value) downloading,
|
|
required TResult Function(SubtitleStarted value) started,
|
|
required TResult Function(SubtitleCancelled value) cancelled,
|
|
required TResult Function(SubtitleFailed value) failed,
|
|
}) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case SubtitleIdle():
|
|
return idle(_that);
|
|
case SubtitleStarting():
|
|
return starting(_that);
|
|
case SubtitleDownloading():
|
|
return downloading(_that);
|
|
case SubtitleStarted():
|
|
return started(_that);
|
|
case SubtitleCancelled():
|
|
return cancelled(_that);
|
|
case SubtitleFailed():
|
|
return failed(_that);
|
|
}
|
|
}
|
|
|
|
/// 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(SubtitleIdle value)? idle,
|
|
TResult? Function(SubtitleStarting value)? starting,
|
|
TResult? Function(SubtitleDownloading value)? downloading,
|
|
TResult? Function(SubtitleStarted value)? started,
|
|
TResult? Function(SubtitleCancelled value)? cancelled,
|
|
TResult? Function(SubtitleFailed value)? failed,
|
|
}) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case SubtitleIdle() when idle != null:
|
|
return idle(_that);
|
|
case SubtitleStarting() when starting != null:
|
|
return starting(_that);
|
|
case SubtitleDownloading() when downloading != null:
|
|
return downloading(_that);
|
|
case SubtitleStarted() when started != null:
|
|
return started(_that);
|
|
case SubtitleCancelled() when cancelled != null:
|
|
return cancelled(_that);
|
|
case SubtitleFailed() when failed != null:
|
|
return failed(_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()? idle,
|
|
TResult Function(SubtitleRequest request)? starting,
|
|
TResult Function(
|
|
SubtitleRequest request,
|
|
ProcessingCapability stage,
|
|
ProcessingResourceRepository? repository,
|
|
double progress,
|
|
bool paused,
|
|
)?
|
|
downloading,
|
|
TResult Function(SubtitleRequest request)? started,
|
|
TResult Function(SubtitleRequest request)? cancelled,
|
|
TResult Function(SubtitleRequest request, SubtitleStartFailure failure)?
|
|
failed,
|
|
required TResult orElse(),
|
|
}) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case SubtitleIdle() when idle != null:
|
|
return idle();
|
|
case SubtitleStarting() when starting != null:
|
|
return starting(_that.request);
|
|
case SubtitleDownloading() when downloading != null:
|
|
return downloading(
|
|
_that.request,
|
|
_that.stage,
|
|
_that.repository,
|
|
_that.progress,
|
|
_that.paused,
|
|
);
|
|
case SubtitleStarted() when started != null:
|
|
return started(_that.request);
|
|
case SubtitleCancelled() when cancelled != null:
|
|
return cancelled(_that.request);
|
|
case SubtitleFailed() when failed != null:
|
|
return failed(_that.request, _that.failure);
|
|
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?>({
|
|
required TResult Function() idle,
|
|
required TResult Function(SubtitleRequest request) starting,
|
|
required TResult Function(
|
|
SubtitleRequest request,
|
|
ProcessingCapability stage,
|
|
ProcessingResourceRepository? repository,
|
|
double progress,
|
|
bool paused,
|
|
)
|
|
downloading,
|
|
required TResult Function(SubtitleRequest request) started,
|
|
required TResult Function(SubtitleRequest request) cancelled,
|
|
required TResult Function(
|
|
SubtitleRequest request,
|
|
SubtitleStartFailure failure,
|
|
)
|
|
failed,
|
|
}) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case SubtitleIdle():
|
|
return idle();
|
|
case SubtitleStarting():
|
|
return starting(_that.request);
|
|
case SubtitleDownloading():
|
|
return downloading(
|
|
_that.request,
|
|
_that.stage,
|
|
_that.repository,
|
|
_that.progress,
|
|
_that.paused,
|
|
);
|
|
case SubtitleStarted():
|
|
return started(_that.request);
|
|
case SubtitleCancelled():
|
|
return cancelled(_that.request);
|
|
case SubtitleFailed():
|
|
return failed(_that.request, _that.failure);
|
|
}
|
|
}
|
|
|
|
/// 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()? idle,
|
|
TResult? Function(SubtitleRequest request)? starting,
|
|
TResult? Function(
|
|
SubtitleRequest request,
|
|
ProcessingCapability stage,
|
|
ProcessingResourceRepository? repository,
|
|
double progress,
|
|
bool paused,
|
|
)?
|
|
downloading,
|
|
TResult? Function(SubtitleRequest request)? started,
|
|
TResult? Function(SubtitleRequest request)? cancelled,
|
|
TResult? Function(SubtitleRequest request, SubtitleStartFailure failure)?
|
|
failed,
|
|
}) {
|
|
final _that = this;
|
|
switch (_that) {
|
|
case SubtitleIdle() when idle != null:
|
|
return idle();
|
|
case SubtitleStarting() when starting != null:
|
|
return starting(_that.request);
|
|
case SubtitleDownloading() when downloading != null:
|
|
return downloading(
|
|
_that.request,
|
|
_that.stage,
|
|
_that.repository,
|
|
_that.progress,
|
|
_that.paused,
|
|
);
|
|
case SubtitleStarted() when started != null:
|
|
return started(_that.request);
|
|
case SubtitleCancelled() when cancelled != null:
|
|
return cancelled(_that.request);
|
|
case SubtitleFailed() when failed != null:
|
|
return failed(_that.request, _that.failure);
|
|
case _:
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
|
|
class SubtitleIdle extends SubtitleDownloadState {
|
|
const SubtitleIdle() : super._();
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
return identical(this, other) ||
|
|
(other.runtimeType == runtimeType && other is SubtitleIdle);
|
|
}
|
|
|
|
@override
|
|
int get hashCode => runtimeType.hashCode;
|
|
|
|
@override
|
|
String toString() {
|
|
return 'SubtitleDownloadState.idle()';
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
|
|
class SubtitleStarting extends SubtitleDownloadState {
|
|
const SubtitleStarting(this.request) : super._();
|
|
|
|
final SubtitleRequest request;
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
@pragma('vm:prefer-inline')
|
|
$SubtitleStartingCopyWith<SubtitleStarting> get copyWith =>
|
|
_$SubtitleStartingCopyWithImpl<SubtitleStarting>(this, _$identity);
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
return identical(this, other) ||
|
|
(other.runtimeType == runtimeType &&
|
|
other is SubtitleStarting &&
|
|
(identical(other.request, request) || other.request == request));
|
|
}
|
|
|
|
@override
|
|
int get hashCode {
|
|
return Object.hash(runtimeType, request);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'SubtitleDownloadState.starting(request: $request)';
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract mixin class $SubtitleStartingCopyWith<$Res>
|
|
implements $SubtitleDownloadStateCopyWith<$Res> {
|
|
factory $SubtitleStartingCopyWith(
|
|
SubtitleStarting value,
|
|
$Res Function(SubtitleStarting) _then,
|
|
) = _$SubtitleStartingCopyWithImpl;
|
|
@useResult
|
|
$Res call({SubtitleRequest request});
|
|
|
|
$SubtitleRequestCopyWith<$Res> get request;
|
|
}
|
|
|
|
/// @nodoc
|
|
class _$SubtitleStartingCopyWithImpl<$Res>
|
|
implements $SubtitleStartingCopyWith<$Res> {
|
|
_$SubtitleStartingCopyWithImpl(this._self, this._then);
|
|
|
|
final SubtitleStarting _self;
|
|
final $Res Function(SubtitleStarting) _then;
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@pragma('vm:prefer-inline')
|
|
$Res call({Object? request = null}) {
|
|
return _then(
|
|
SubtitleStarting(
|
|
null == request
|
|
? _self.request
|
|
: request // ignore: cast_nullable_to_non_nullable
|
|
as SubtitleRequest,
|
|
),
|
|
);
|
|
}
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$SubtitleRequestCopyWith<$Res> get request {
|
|
return $SubtitleRequestCopyWith<$Res>(_self.request, (value) {
|
|
return _then(_self.copyWith(request: value));
|
|
});
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
|
|
class SubtitleDownloading extends SubtitleDownloadState {
|
|
const SubtitleDownloading(
|
|
this.request, {
|
|
required this.stage,
|
|
this.repository,
|
|
this.progress = 0,
|
|
this.paused = false,
|
|
}) : super._();
|
|
|
|
final SubtitleRequest request;
|
|
final ProcessingCapability stage;
|
|
final ProcessingResourceRepository? repository;
|
|
@JsonKey()
|
|
final double progress;
|
|
@JsonKey()
|
|
final bool paused;
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
@pragma('vm:prefer-inline')
|
|
$SubtitleDownloadingCopyWith<SubtitleDownloading> get copyWith =>
|
|
_$SubtitleDownloadingCopyWithImpl<SubtitleDownloading>(this, _$identity);
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
return identical(this, other) ||
|
|
(other.runtimeType == runtimeType &&
|
|
other is SubtitleDownloading &&
|
|
(identical(other.request, request) || other.request == request) &&
|
|
(identical(other.stage, stage) || other.stage == stage) &&
|
|
(identical(other.repository, repository) ||
|
|
other.repository == repository) &&
|
|
(identical(other.progress, progress) ||
|
|
other.progress == progress) &&
|
|
(identical(other.paused, paused) || other.paused == paused));
|
|
}
|
|
|
|
@override
|
|
int get hashCode {
|
|
return Object.hash(
|
|
runtimeType,
|
|
request,
|
|
stage,
|
|
repository,
|
|
progress,
|
|
paused,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'SubtitleDownloadState.downloading(request: $request, stage: $stage, repository: $repository, progress: $progress, paused: $paused)';
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract mixin class $SubtitleDownloadingCopyWith<$Res>
|
|
implements $SubtitleDownloadStateCopyWith<$Res> {
|
|
factory $SubtitleDownloadingCopyWith(
|
|
SubtitleDownloading value,
|
|
$Res Function(SubtitleDownloading) _then,
|
|
) = _$SubtitleDownloadingCopyWithImpl;
|
|
@useResult
|
|
$Res call({
|
|
SubtitleRequest request,
|
|
ProcessingCapability stage,
|
|
ProcessingResourceRepository? repository,
|
|
double progress,
|
|
bool paused,
|
|
});
|
|
|
|
$SubtitleRequestCopyWith<$Res> get request;
|
|
}
|
|
|
|
/// @nodoc
|
|
class _$SubtitleDownloadingCopyWithImpl<$Res>
|
|
implements $SubtitleDownloadingCopyWith<$Res> {
|
|
_$SubtitleDownloadingCopyWithImpl(this._self, this._then);
|
|
|
|
final SubtitleDownloading _self;
|
|
final $Res Function(SubtitleDownloading) _then;
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@pragma('vm:prefer-inline')
|
|
$Res call({
|
|
Object? request = null,
|
|
Object? stage = null,
|
|
Object? repository = freezed,
|
|
Object? progress = null,
|
|
Object? paused = null,
|
|
}) {
|
|
return _then(
|
|
SubtitleDownloading(
|
|
null == request
|
|
? _self.request
|
|
: request // ignore: cast_nullable_to_non_nullable
|
|
as SubtitleRequest,
|
|
stage: null == stage
|
|
? _self.stage
|
|
: stage // ignore: cast_nullable_to_non_nullable
|
|
as ProcessingCapability,
|
|
repository: freezed == repository
|
|
? _self.repository
|
|
: repository // ignore: cast_nullable_to_non_nullable
|
|
as ProcessingResourceRepository?,
|
|
progress: null == progress
|
|
? _self.progress
|
|
: progress // ignore: cast_nullable_to_non_nullable
|
|
as double,
|
|
paused: null == paused
|
|
? _self.paused
|
|
: paused // ignore: cast_nullable_to_non_nullable
|
|
as bool,
|
|
),
|
|
);
|
|
}
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$SubtitleRequestCopyWith<$Res> get request {
|
|
return $SubtitleRequestCopyWith<$Res>(_self.request, (value) {
|
|
return _then(_self.copyWith(request: value));
|
|
});
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
|
|
class SubtitleStarted extends SubtitleDownloadState {
|
|
const SubtitleStarted(this.request) : super._();
|
|
|
|
final SubtitleRequest request;
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
@pragma('vm:prefer-inline')
|
|
$SubtitleStartedCopyWith<SubtitleStarted> get copyWith =>
|
|
_$SubtitleStartedCopyWithImpl<SubtitleStarted>(this, _$identity);
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
return identical(this, other) ||
|
|
(other.runtimeType == runtimeType &&
|
|
other is SubtitleStarted &&
|
|
(identical(other.request, request) || other.request == request));
|
|
}
|
|
|
|
@override
|
|
int get hashCode {
|
|
return Object.hash(runtimeType, request);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'SubtitleDownloadState.started(request: $request)';
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract mixin class $SubtitleStartedCopyWith<$Res>
|
|
implements $SubtitleDownloadStateCopyWith<$Res> {
|
|
factory $SubtitleStartedCopyWith(
|
|
SubtitleStarted value,
|
|
$Res Function(SubtitleStarted) _then,
|
|
) = _$SubtitleStartedCopyWithImpl;
|
|
@useResult
|
|
$Res call({SubtitleRequest request});
|
|
|
|
$SubtitleRequestCopyWith<$Res> get request;
|
|
}
|
|
|
|
/// @nodoc
|
|
class _$SubtitleStartedCopyWithImpl<$Res>
|
|
implements $SubtitleStartedCopyWith<$Res> {
|
|
_$SubtitleStartedCopyWithImpl(this._self, this._then);
|
|
|
|
final SubtitleStarted _self;
|
|
final $Res Function(SubtitleStarted) _then;
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@pragma('vm:prefer-inline')
|
|
$Res call({Object? request = null}) {
|
|
return _then(
|
|
SubtitleStarted(
|
|
null == request
|
|
? _self.request
|
|
: request // ignore: cast_nullable_to_non_nullable
|
|
as SubtitleRequest,
|
|
),
|
|
);
|
|
}
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$SubtitleRequestCopyWith<$Res> get request {
|
|
return $SubtitleRequestCopyWith<$Res>(_self.request, (value) {
|
|
return _then(_self.copyWith(request: value));
|
|
});
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
|
|
class SubtitleCancelled extends SubtitleDownloadState {
|
|
const SubtitleCancelled(this.request) : super._();
|
|
|
|
final SubtitleRequest request;
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
@pragma('vm:prefer-inline')
|
|
$SubtitleCancelledCopyWith<SubtitleCancelled> get copyWith =>
|
|
_$SubtitleCancelledCopyWithImpl<SubtitleCancelled>(this, _$identity);
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
return identical(this, other) ||
|
|
(other.runtimeType == runtimeType &&
|
|
other is SubtitleCancelled &&
|
|
(identical(other.request, request) || other.request == request));
|
|
}
|
|
|
|
@override
|
|
int get hashCode {
|
|
return Object.hash(runtimeType, request);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'SubtitleDownloadState.cancelled(request: $request)';
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract mixin class $SubtitleCancelledCopyWith<$Res>
|
|
implements $SubtitleDownloadStateCopyWith<$Res> {
|
|
factory $SubtitleCancelledCopyWith(
|
|
SubtitleCancelled value,
|
|
$Res Function(SubtitleCancelled) _then,
|
|
) = _$SubtitleCancelledCopyWithImpl;
|
|
@useResult
|
|
$Res call({SubtitleRequest request});
|
|
|
|
$SubtitleRequestCopyWith<$Res> get request;
|
|
}
|
|
|
|
/// @nodoc
|
|
class _$SubtitleCancelledCopyWithImpl<$Res>
|
|
implements $SubtitleCancelledCopyWith<$Res> {
|
|
_$SubtitleCancelledCopyWithImpl(this._self, this._then);
|
|
|
|
final SubtitleCancelled _self;
|
|
final $Res Function(SubtitleCancelled) _then;
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@pragma('vm:prefer-inline')
|
|
$Res call({Object? request = null}) {
|
|
return _then(
|
|
SubtitleCancelled(
|
|
null == request
|
|
? _self.request
|
|
: request // ignore: cast_nullable_to_non_nullable
|
|
as SubtitleRequest,
|
|
),
|
|
);
|
|
}
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$SubtitleRequestCopyWith<$Res> get request {
|
|
return $SubtitleRequestCopyWith<$Res>(_self.request, (value) {
|
|
return _then(_self.copyWith(request: value));
|
|
});
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
|
|
class SubtitleFailed extends SubtitleDownloadState {
|
|
const SubtitleFailed(this.request, this.failure) : super._();
|
|
|
|
final SubtitleRequest request;
|
|
final SubtitleStartFailure failure;
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
@pragma('vm:prefer-inline')
|
|
$SubtitleFailedCopyWith<SubtitleFailed> get copyWith =>
|
|
_$SubtitleFailedCopyWithImpl<SubtitleFailed>(this, _$identity);
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
return identical(this, other) ||
|
|
(other.runtimeType == runtimeType &&
|
|
other is SubtitleFailed &&
|
|
(identical(other.request, request) || other.request == request) &&
|
|
(identical(other.failure, failure) || other.failure == failure));
|
|
}
|
|
|
|
@override
|
|
int get hashCode {
|
|
return Object.hash(runtimeType, request, failure);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'SubtitleDownloadState.failed(request: $request, failure: $failure)';
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract mixin class $SubtitleFailedCopyWith<$Res>
|
|
implements $SubtitleDownloadStateCopyWith<$Res> {
|
|
factory $SubtitleFailedCopyWith(
|
|
SubtitleFailed value,
|
|
$Res Function(SubtitleFailed) _then,
|
|
) = _$SubtitleFailedCopyWithImpl;
|
|
@useResult
|
|
$Res call({SubtitleRequest request, SubtitleStartFailure failure});
|
|
|
|
$SubtitleRequestCopyWith<$Res> get request;
|
|
}
|
|
|
|
/// @nodoc
|
|
class _$SubtitleFailedCopyWithImpl<$Res>
|
|
implements $SubtitleFailedCopyWith<$Res> {
|
|
_$SubtitleFailedCopyWithImpl(this._self, this._then);
|
|
|
|
final SubtitleFailed _self;
|
|
final $Res Function(SubtitleFailed) _then;
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@pragma('vm:prefer-inline')
|
|
$Res call({Object? request = null, Object? failure = null}) {
|
|
return _then(
|
|
SubtitleFailed(
|
|
null == request
|
|
? _self.request
|
|
: request // ignore: cast_nullable_to_non_nullable
|
|
as SubtitleRequest,
|
|
null == failure
|
|
? _self.failure
|
|
: failure // ignore: cast_nullable_to_non_nullable
|
|
as SubtitleStartFailure,
|
|
),
|
|
);
|
|
}
|
|
|
|
/// Create a copy of SubtitleDownloadState
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
$SubtitleRequestCopyWith<$Res> get request {
|
|
return $SubtitleRequestCopyWith<$Res>(_self.request, (value) {
|
|
return _then(_self.copyWith(request: value));
|
|
});
|
|
}
|
|
}
|