mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
chore:cleanup-packages breaking: remove isar (#474)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
ab6182f69d
commit
6357b9843c
81 changed files with 31400 additions and 25673 deletions
|
|
@ -1,61 +0,0 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:isar/isar.dart';
|
||||
|
||||
import 'package:fladder/models/syncing/sync_item.dart';
|
||||
|
||||
part 'i_synced_item.g.dart';
|
||||
|
||||
@collection
|
||||
class ISyncedItem {
|
||||
String? userId;
|
||||
String id;
|
||||
bool syncing;
|
||||
String? sortName;
|
||||
@Index()
|
||||
String? parentId;
|
||||
String? path;
|
||||
int? fileSize;
|
||||
String? videoFileName;
|
||||
String? trickPlayModel;
|
||||
String? mediaSegments;
|
||||
String? images;
|
||||
List<String>? chapters;
|
||||
List<String>? subtitles;
|
||||
String? userData;
|
||||
ISyncedItem({
|
||||
this.userId,
|
||||
required this.id,
|
||||
required this.syncing,
|
||||
this.sortName,
|
||||
this.parentId,
|
||||
this.path,
|
||||
this.fileSize,
|
||||
this.videoFileName,
|
||||
this.trickPlayModel,
|
||||
this.mediaSegments,
|
||||
this.images,
|
||||
this.chapters,
|
||||
this.subtitles,
|
||||
this.userData,
|
||||
});
|
||||
|
||||
factory ISyncedItem.fromSynced(SyncedItem syncedItem, String? path) {
|
||||
return ISyncedItem(
|
||||
id: syncedItem.id,
|
||||
parentId: syncedItem.parentId,
|
||||
syncing: syncedItem.syncing,
|
||||
userId: syncedItem.userId,
|
||||
path: syncedItem.path?.replaceAll(path ?? "", '').substring(1),
|
||||
fileSize: syncedItem.fileSize,
|
||||
sortName: syncedItem.sortName,
|
||||
videoFileName: syncedItem.videoFileName,
|
||||
trickPlayModel: syncedItem.fTrickPlayModel != null ? jsonEncode(syncedItem.fTrickPlayModel?.toJson()) : null,
|
||||
mediaSegments: syncedItem.mediaSegments != null ? jsonEncode(syncedItem.mediaSegments?.toJson()) : null,
|
||||
images: syncedItem.fImages != null ? jsonEncode(syncedItem.fImages?.toJson()) : null,
|
||||
chapters: syncedItem.fChapters.map((e) => jsonEncode(e.toJson())).toList(),
|
||||
subtitles: syncedItem.subtitles.map((e) => jsonEncode(e.toJson())).toList(),
|
||||
userData: syncedItem.userData != null ? jsonEncode(syncedItem.userData?.toJson()) : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -17,13 +17,12 @@ import 'package:fladder/models/items/item_shared_models.dart';
|
|||
import 'package:fladder/models/items/media_segments_model.dart';
|
||||
import 'package:fladder/models/items/media_streams_model.dart';
|
||||
import 'package:fladder/models/items/trick_play_model.dart';
|
||||
import 'package:fladder/models/syncing/i_synced_item.dart';
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
|
||||
part 'sync_item.freezed.dart';
|
||||
|
||||
@Freezed(copyWith: true)
|
||||
class SyncedItem with _$SyncedItem {
|
||||
abstract class SyncedItem with _$SyncedItem {
|
||||
const SyncedItem._();
|
||||
|
||||
factory SyncedItem({
|
||||
|
|
@ -126,39 +125,6 @@ class SyncedItem with _$SyncedItem {
|
|||
userData: userData,
|
||||
);
|
||||
}
|
||||
|
||||
factory SyncedItem.fromIsar(ISyncedItem isarSyncedItem, String savePath) {
|
||||
return SyncedItem(
|
||||
id: isarSyncedItem.id,
|
||||
parentId: isarSyncedItem.parentId,
|
||||
userId: isarSyncedItem.userId ?? "",
|
||||
sortName: isarSyncedItem.sortName,
|
||||
syncing: isarSyncedItem.syncing,
|
||||
path: joinAll([savePath, isarSyncedItem.path ?? ""]),
|
||||
fileSize: isarSyncedItem.fileSize,
|
||||
videoFileName: isarSyncedItem.videoFileName,
|
||||
mediaSegments: isarSyncedItem.mediaSegments != null
|
||||
? MediaSegmentsModel.fromJson(jsonDecode(isarSyncedItem.mediaSegments!))
|
||||
: null,
|
||||
fTrickPlayModel: isarSyncedItem.trickPlayModel != null
|
||||
? TrickPlayModel.fromJson(jsonDecode(isarSyncedItem.trickPlayModel!))
|
||||
: null,
|
||||
fImages: isarSyncedItem.images != null ? ImagesData.fromJson(jsonDecode(isarSyncedItem.images!)) : null,
|
||||
fChapters: isarSyncedItem.chapters
|
||||
?.map(
|
||||
(e) => Chapter.fromJson(jsonDecode(e)),
|
||||
)
|
||||
.toList() ??
|
||||
[],
|
||||
subtitles: isarSyncedItem.subtitles
|
||||
?.map(
|
||||
(e) => SubStreamModel.fromJson(jsonDecode(e)),
|
||||
)
|
||||
.toList() ??
|
||||
[],
|
||||
userData: isarSyncedItem.userData != null ? UserData.fromJson(jsonDecode(isarSyncedItem.userData!)) : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
extension StatusExtension on TaskStatus {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// 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
|
||||
|
||||
|
|
@ -9,46 +9,49 @@ part of 'sync_item.dart';
|
|||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(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 _$SyncedItem {
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
bool get syncing => throw _privateConstructorUsedError;
|
||||
String? get parentId => throw _privateConstructorUsedError;
|
||||
String get userId => throw _privateConstructorUsedError;
|
||||
String? get path => throw _privateConstructorUsedError;
|
||||
bool get markedForDelete => throw _privateConstructorUsedError;
|
||||
String? get sortName => throw _privateConstructorUsedError;
|
||||
int? get fileSize => throw _privateConstructorUsedError;
|
||||
String? get videoFileName => throw _privateConstructorUsedError;
|
||||
MediaSegmentsModel? get mediaSegments => throw _privateConstructorUsedError;
|
||||
TrickPlayModel? get fTrickPlayModel => throw _privateConstructorUsedError;
|
||||
ImagesData? get fImages => throw _privateConstructorUsedError;
|
||||
List<Chapter> get fChapters => throw _privateConstructorUsedError;
|
||||
List<SubStreamModel> get subtitles => throw _privateConstructorUsedError;
|
||||
bool get unSyncedData => throw _privateConstructorUsedError;
|
||||
String get id;
|
||||
bool get syncing;
|
||||
String? get parentId;
|
||||
String get userId;
|
||||
String? get path;
|
||||
bool get markedForDelete;
|
||||
String? get sortName;
|
||||
int? get fileSize;
|
||||
String? get videoFileName;
|
||||
MediaSegmentsModel? get mediaSegments;
|
||||
TrickPlayModel? get fTrickPlayModel;
|
||||
ImagesData? get fImages;
|
||||
List<Chapter> get fChapters;
|
||||
List<SubStreamModel> get subtitles;
|
||||
bool get unSyncedData;
|
||||
@UserDataJsonSerializer()
|
||||
UserData? get userData =>
|
||||
throw _privateConstructorUsedError; // ignore: invalid_annotation_target
|
||||
UserData? get userData; // ignore: invalid_annotation_target
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
ItemBaseModel? get itemModel => throw _privateConstructorUsedError;
|
||||
ItemBaseModel? get itemModel;
|
||||
|
||||
/// Create a copy of SyncedItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$SyncedItemCopyWith<SyncedItem> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
_$SyncedItemCopyWithImpl<SyncedItem>(this as SyncedItem, _$identity);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SyncedItem(id: $id, syncing: $syncing, parentId: $parentId, userId: $userId, path: $path, markedForDelete: $markedForDelete, sortName: $sortName, fileSize: $fileSize, videoFileName: $videoFileName, mediaSegments: $mediaSegments, fTrickPlayModel: $fTrickPlayModel, fImages: $fImages, fChapters: $fChapters, subtitles: $subtitles, unSyncedData: $unSyncedData, userData: $userData, itemModel: $itemModel)';
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SyncedItemCopyWith<$Res> {
|
||||
abstract mixin class $SyncedItemCopyWith<$Res> {
|
||||
factory $SyncedItemCopyWith(
|
||||
SyncedItem value, $Res Function(SyncedItem) then) =
|
||||
_$SyncedItemCopyWithImpl<$Res, SyncedItem>;
|
||||
SyncedItem value, $Res Function(SyncedItem) _then) =
|
||||
_$SyncedItemCopyWithImpl;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String id,
|
||||
|
|
@ -74,14 +77,11 @@ abstract class $SyncedItemCopyWith<$Res> {
|
|||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SyncedItemCopyWithImpl<$Res, $Val extends SyncedItem>
|
||||
implements $SyncedItemCopyWith<$Res> {
|
||||
_$SyncedItemCopyWithImpl(this._value, this._then);
|
||||
class _$SyncedItemCopyWithImpl<$Res> implements $SyncedItemCopyWith<$Res> {
|
||||
_$SyncedItemCopyWithImpl(this._self, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
final SyncedItem _self;
|
||||
final $Res Function(SyncedItem) _then;
|
||||
|
||||
/// Create a copy of SyncedItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
|
@ -106,76 +106,76 @@ class _$SyncedItemCopyWithImpl<$Res, $Val extends SyncedItem>
|
|||
Object? userData = freezed,
|
||||
Object? itemModel = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
return _then(_self.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
? _self.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
syncing: null == syncing
|
||||
? _value.syncing
|
||||
? _self.syncing
|
||||
: syncing // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
parentId: freezed == parentId
|
||||
? _value.parentId
|
||||
? _self.parentId
|
||||
: parentId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
userId: null == userId
|
||||
? _value.userId
|
||||
? _self.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
path: freezed == path
|
||||
? _value.path
|
||||
? _self.path
|
||||
: path // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
markedForDelete: null == markedForDelete
|
||||
? _value.markedForDelete
|
||||
? _self.markedForDelete
|
||||
: markedForDelete // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
sortName: freezed == sortName
|
||||
? _value.sortName
|
||||
? _self.sortName
|
||||
: sortName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
fileSize: freezed == fileSize
|
||||
? _value.fileSize
|
||||
? _self.fileSize
|
||||
: fileSize // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
videoFileName: freezed == videoFileName
|
||||
? _value.videoFileName
|
||||
? _self.videoFileName
|
||||
: videoFileName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
mediaSegments: freezed == mediaSegments
|
||||
? _value.mediaSegments
|
||||
? _self.mediaSegments
|
||||
: mediaSegments // ignore: cast_nullable_to_non_nullable
|
||||
as MediaSegmentsModel?,
|
||||
fTrickPlayModel: freezed == fTrickPlayModel
|
||||
? _value.fTrickPlayModel
|
||||
? _self.fTrickPlayModel
|
||||
: fTrickPlayModel // ignore: cast_nullable_to_non_nullable
|
||||
as TrickPlayModel?,
|
||||
fImages: freezed == fImages
|
||||
? _value.fImages
|
||||
? _self.fImages
|
||||
: fImages // ignore: cast_nullable_to_non_nullable
|
||||
as ImagesData?,
|
||||
fChapters: null == fChapters
|
||||
? _value.fChapters
|
||||
? _self.fChapters
|
||||
: fChapters // ignore: cast_nullable_to_non_nullable
|
||||
as List<Chapter>,
|
||||
subtitles: null == subtitles
|
||||
? _value.subtitles
|
||||
? _self.subtitles
|
||||
: subtitles // ignore: cast_nullable_to_non_nullable
|
||||
as List<SubStreamModel>,
|
||||
unSyncedData: null == unSyncedData
|
||||
? _value.unSyncedData
|
||||
? _self.unSyncedData
|
||||
: unSyncedData // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
userData: freezed == userData
|
||||
? _value.userData
|
||||
? _self.userData
|
||||
: userData // ignore: cast_nullable_to_non_nullable
|
||||
as UserData?,
|
||||
itemModel: freezed == itemModel
|
||||
? _value.itemModel
|
||||
? _self.itemModel
|
||||
: itemModel // ignore: cast_nullable_to_non_nullable
|
||||
as ItemBaseModel?,
|
||||
) as $Val);
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of SyncedItem
|
||||
|
|
@ -183,156 +183,285 @@ class _$SyncedItemCopyWithImpl<$Res, $Val extends SyncedItem>
|
|||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$TrickPlayModelCopyWith<$Res>? get fTrickPlayModel {
|
||||
if (_value.fTrickPlayModel == null) {
|
||||
if (_self.fTrickPlayModel == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $TrickPlayModelCopyWith<$Res>(_value.fTrickPlayModel!, (value) {
|
||||
return _then(_value.copyWith(fTrickPlayModel: value) as $Val);
|
||||
return $TrickPlayModelCopyWith<$Res>(_self.fTrickPlayModel!, (value) {
|
||||
return _then(_self.copyWith(fTrickPlayModel: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SyncItemImplCopyWith<$Res>
|
||||
implements $SyncedItemCopyWith<$Res> {
|
||||
factory _$$SyncItemImplCopyWith(
|
||||
_$SyncItemImpl value, $Res Function(_$SyncItemImpl) then) =
|
||||
__$$SyncItemImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String id,
|
||||
bool syncing,
|
||||
String? parentId,
|
||||
String userId,
|
||||
String? path,
|
||||
bool markedForDelete,
|
||||
String? sortName,
|
||||
int? fileSize,
|
||||
String? videoFileName,
|
||||
MediaSegmentsModel? mediaSegments,
|
||||
TrickPlayModel? fTrickPlayModel,
|
||||
ImagesData? fImages,
|
||||
List<Chapter> fChapters,
|
||||
List<SubStreamModel> subtitles,
|
||||
bool unSyncedData,
|
||||
@UserDataJsonSerializer() UserData? userData,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
ItemBaseModel? itemModel});
|
||||
/// Adds pattern-matching-related methods to [SyncedItem].
|
||||
extension SyncedItemPatterns on SyncedItem {
|
||||
/// 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();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@override
|
||||
$TrickPlayModelCopyWith<$Res>? get fTrickPlayModel;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SyncItemImplCopyWithImpl<$Res>
|
||||
extends _$SyncedItemCopyWithImpl<$Res, _$SyncItemImpl>
|
||||
implements _$$SyncItemImplCopyWith<$Res> {
|
||||
__$$SyncItemImplCopyWithImpl(
|
||||
_$SyncItemImpl _value, $Res Function(_$SyncItemImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of SyncedItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? syncing = null,
|
||||
Object? parentId = freezed,
|
||||
Object? userId = null,
|
||||
Object? path = freezed,
|
||||
Object? markedForDelete = null,
|
||||
Object? sortName = freezed,
|
||||
Object? fileSize = freezed,
|
||||
Object? videoFileName = freezed,
|
||||
Object? mediaSegments = freezed,
|
||||
Object? fTrickPlayModel = freezed,
|
||||
Object? fImages = freezed,
|
||||
Object? fChapters = null,
|
||||
Object? subtitles = null,
|
||||
Object? unSyncedData = null,
|
||||
Object? userData = freezed,
|
||||
Object? itemModel = freezed,
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_SyncItem value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
return _then(_$SyncItemImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
syncing: null == syncing
|
||||
? _value.syncing
|
||||
: syncing // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
parentId: freezed == parentId
|
||||
? _value.parentId
|
||||
: parentId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
userId: null == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
path: freezed == path
|
||||
? _value.path
|
||||
: path // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
markedForDelete: null == markedForDelete
|
||||
? _value.markedForDelete
|
||||
: markedForDelete // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
sortName: freezed == sortName
|
||||
? _value.sortName
|
||||
: sortName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
fileSize: freezed == fileSize
|
||||
? _value.fileSize
|
||||
: fileSize // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
videoFileName: freezed == videoFileName
|
||||
? _value.videoFileName
|
||||
: videoFileName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
mediaSegments: freezed == mediaSegments
|
||||
? _value.mediaSegments
|
||||
: mediaSegments // ignore: cast_nullable_to_non_nullable
|
||||
as MediaSegmentsModel?,
|
||||
fTrickPlayModel: freezed == fTrickPlayModel
|
||||
? _value.fTrickPlayModel
|
||||
: fTrickPlayModel // ignore: cast_nullable_to_non_nullable
|
||||
as TrickPlayModel?,
|
||||
fImages: freezed == fImages
|
||||
? _value.fImages
|
||||
: fImages // ignore: cast_nullable_to_non_nullable
|
||||
as ImagesData?,
|
||||
fChapters: null == fChapters
|
||||
? _value._fChapters
|
||||
: fChapters // ignore: cast_nullable_to_non_nullable
|
||||
as List<Chapter>,
|
||||
subtitles: null == subtitles
|
||||
? _value._subtitles
|
||||
: subtitles // ignore: cast_nullable_to_non_nullable
|
||||
as List<SubStreamModel>,
|
||||
unSyncedData: null == unSyncedData
|
||||
? _value.unSyncedData
|
||||
: unSyncedData // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
userData: freezed == userData
|
||||
? _value.userData
|
||||
: userData // ignore: cast_nullable_to_non_nullable
|
||||
as UserData?,
|
||||
itemModel: freezed == itemModel
|
||||
? _value.itemModel
|
||||
: itemModel // ignore: cast_nullable_to_non_nullable
|
||||
as ItemBaseModel?,
|
||||
));
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncItem() 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(_SyncItem value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncItem():
|
||||
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(_SyncItem value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncItem() 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 id,
|
||||
bool syncing,
|
||||
String? parentId,
|
||||
String userId,
|
||||
String? path,
|
||||
bool markedForDelete,
|
||||
String? sortName,
|
||||
int? fileSize,
|
||||
String? videoFileName,
|
||||
MediaSegmentsModel? mediaSegments,
|
||||
TrickPlayModel? fTrickPlayModel,
|
||||
ImagesData? fImages,
|
||||
List<Chapter> fChapters,
|
||||
List<SubStreamModel> subtitles,
|
||||
bool unSyncedData,
|
||||
@UserDataJsonSerializer() UserData? userData,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
ItemBaseModel? itemModel)?
|
||||
$default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncItem() when $default != null:
|
||||
return $default(
|
||||
_that.id,
|
||||
_that.syncing,
|
||||
_that.parentId,
|
||||
_that.userId,
|
||||
_that.path,
|
||||
_that.markedForDelete,
|
||||
_that.sortName,
|
||||
_that.fileSize,
|
||||
_that.videoFileName,
|
||||
_that.mediaSegments,
|
||||
_that.fTrickPlayModel,
|
||||
_that.fImages,
|
||||
_that.fChapters,
|
||||
_that.subtitles,
|
||||
_that.unSyncedData,
|
||||
_that.userData,
|
||||
_that.itemModel);
|
||||
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 id,
|
||||
bool syncing,
|
||||
String? parentId,
|
||||
String userId,
|
||||
String? path,
|
||||
bool markedForDelete,
|
||||
String? sortName,
|
||||
int? fileSize,
|
||||
String? videoFileName,
|
||||
MediaSegmentsModel? mediaSegments,
|
||||
TrickPlayModel? fTrickPlayModel,
|
||||
ImagesData? fImages,
|
||||
List<Chapter> fChapters,
|
||||
List<SubStreamModel> subtitles,
|
||||
bool unSyncedData,
|
||||
@UserDataJsonSerializer() UserData? userData,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
ItemBaseModel? itemModel)
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncItem():
|
||||
return $default(
|
||||
_that.id,
|
||||
_that.syncing,
|
||||
_that.parentId,
|
||||
_that.userId,
|
||||
_that.path,
|
||||
_that.markedForDelete,
|
||||
_that.sortName,
|
||||
_that.fileSize,
|
||||
_that.videoFileName,
|
||||
_that.mediaSegments,
|
||||
_that.fTrickPlayModel,
|
||||
_that.fImages,
|
||||
_that.fChapters,
|
||||
_that.subtitles,
|
||||
_that.unSyncedData,
|
||||
_that.userData,
|
||||
_that.itemModel);
|
||||
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 id,
|
||||
bool syncing,
|
||||
String? parentId,
|
||||
String userId,
|
||||
String? path,
|
||||
bool markedForDelete,
|
||||
String? sortName,
|
||||
int? fileSize,
|
||||
String? videoFileName,
|
||||
MediaSegmentsModel? mediaSegments,
|
||||
TrickPlayModel? fTrickPlayModel,
|
||||
ImagesData? fImages,
|
||||
List<Chapter> fChapters,
|
||||
List<SubStreamModel> subtitles,
|
||||
bool unSyncedData,
|
||||
@UserDataJsonSerializer() UserData? userData,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
ItemBaseModel? itemModel)?
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncItem() when $default != null:
|
||||
return $default(
|
||||
_that.id,
|
||||
_that.syncing,
|
||||
_that.parentId,
|
||||
_that.userId,
|
||||
_that.path,
|
||||
_that.markedForDelete,
|
||||
_that.sortName,
|
||||
_that.fileSize,
|
||||
_that.videoFileName,
|
||||
_that.mediaSegments,
|
||||
_that.fTrickPlayModel,
|
||||
_that.fImages,
|
||||
_that.fChapters,
|
||||
_that.subtitles,
|
||||
_that.unSyncedData,
|
||||
_that.userData,
|
||||
_that.itemModel);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SyncItemImpl extends _SyncItem {
|
||||
_$SyncItemImpl(
|
||||
class _SyncItem extends SyncedItem {
|
||||
_SyncItem(
|
||||
{required this.id,
|
||||
this.syncing = false,
|
||||
this.parentId,
|
||||
|
|
@ -409,83 +538,166 @@ class _$SyncItemImpl extends _SyncItem {
|
|||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
final ItemBaseModel? itemModel;
|
||||
|
||||
/// Create a copy of SyncedItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$SyncItemCopyWith<_SyncItem> get copyWith =>
|
||||
__$SyncItemCopyWithImpl<_SyncItem>(this, _$identity);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SyncedItem(id: $id, syncing: $syncing, parentId: $parentId, userId: $userId, path: $path, markedForDelete: $markedForDelete, sortName: $sortName, fileSize: $fileSize, videoFileName: $videoFileName, mediaSegments: $mediaSegments, fTrickPlayModel: $fTrickPlayModel, fImages: $fImages, fChapters: $fChapters, subtitles: $subtitles, unSyncedData: $unSyncedData, userData: $userData, itemModel: $itemModel)';
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$SyncItemCopyWith<$Res>
|
||||
implements $SyncedItemCopyWith<$Res> {
|
||||
factory _$SyncItemCopyWith(_SyncItem value, $Res Function(_SyncItem) _then) =
|
||||
__$SyncItemCopyWithImpl;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String id,
|
||||
bool syncing,
|
||||
String? parentId,
|
||||
String userId,
|
||||
String? path,
|
||||
bool markedForDelete,
|
||||
String? sortName,
|
||||
int? fileSize,
|
||||
String? videoFileName,
|
||||
MediaSegmentsModel? mediaSegments,
|
||||
TrickPlayModel? fTrickPlayModel,
|
||||
ImagesData? fImages,
|
||||
List<Chapter> fChapters,
|
||||
List<SubStreamModel> subtitles,
|
||||
bool unSyncedData,
|
||||
@UserDataJsonSerializer() UserData? userData,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
ItemBaseModel? itemModel});
|
||||
|
||||
@override
|
||||
$TrickPlayModelCopyWith<$Res>? get fTrickPlayModel;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$SyncItemCopyWithImpl<$Res> implements _$SyncItemCopyWith<$Res> {
|
||||
__$SyncItemCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _SyncItem _self;
|
||||
final $Res Function(_SyncItem) _then;
|
||||
|
||||
/// Create a copy of SyncedItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SyncItemImplCopyWith<_$SyncItemImpl> get copyWith =>
|
||||
__$$SyncItemImplCopyWithImpl<_$SyncItemImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _SyncItem extends SyncedItem {
|
||||
factory _SyncItem(
|
||||
{required final String id,
|
||||
final bool syncing,
|
||||
final String? parentId,
|
||||
required final String userId,
|
||||
final String? path,
|
||||
final bool markedForDelete,
|
||||
final String? sortName,
|
||||
final int? fileSize,
|
||||
final String? videoFileName,
|
||||
final MediaSegmentsModel? mediaSegments,
|
||||
final TrickPlayModel? fTrickPlayModel,
|
||||
final ImagesData? fImages,
|
||||
final List<Chapter> fChapters,
|
||||
final List<SubStreamModel> subtitles,
|
||||
final bool unSyncedData,
|
||||
@UserDataJsonSerializer() final UserData? userData,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
final ItemBaseModel? itemModel}) = _$SyncItemImpl;
|
||||
_SyncItem._() : super._();
|
||||
|
||||
@override
|
||||
String get id;
|
||||
@override
|
||||
bool get syncing;
|
||||
@override
|
||||
String? get parentId;
|
||||
@override
|
||||
String get userId;
|
||||
@override
|
||||
String? get path;
|
||||
@override
|
||||
bool get markedForDelete;
|
||||
@override
|
||||
String? get sortName;
|
||||
@override
|
||||
int? get fileSize;
|
||||
@override
|
||||
String? get videoFileName;
|
||||
@override
|
||||
MediaSegmentsModel? get mediaSegments;
|
||||
@override
|
||||
TrickPlayModel? get fTrickPlayModel;
|
||||
@override
|
||||
ImagesData? get fImages;
|
||||
@override
|
||||
List<Chapter> get fChapters;
|
||||
@override
|
||||
List<SubStreamModel> get subtitles;
|
||||
@override
|
||||
bool get unSyncedData;
|
||||
@override
|
||||
@UserDataJsonSerializer()
|
||||
UserData? get userData; // ignore: invalid_annotation_target
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
ItemBaseModel? get itemModel;
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? syncing = null,
|
||||
Object? parentId = freezed,
|
||||
Object? userId = null,
|
||||
Object? path = freezed,
|
||||
Object? markedForDelete = null,
|
||||
Object? sortName = freezed,
|
||||
Object? fileSize = freezed,
|
||||
Object? videoFileName = freezed,
|
||||
Object? mediaSegments = freezed,
|
||||
Object? fTrickPlayModel = freezed,
|
||||
Object? fImages = freezed,
|
||||
Object? fChapters = null,
|
||||
Object? subtitles = null,
|
||||
Object? unSyncedData = null,
|
||||
Object? userData = freezed,
|
||||
Object? itemModel = freezed,
|
||||
}) {
|
||||
return _then(_SyncItem(
|
||||
id: null == id
|
||||
? _self.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
syncing: null == syncing
|
||||
? _self.syncing
|
||||
: syncing // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
parentId: freezed == parentId
|
||||
? _self.parentId
|
||||
: parentId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
userId: null == userId
|
||||
? _self.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
path: freezed == path
|
||||
? _self.path
|
||||
: path // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
markedForDelete: null == markedForDelete
|
||||
? _self.markedForDelete
|
||||
: markedForDelete // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
sortName: freezed == sortName
|
||||
? _self.sortName
|
||||
: sortName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
fileSize: freezed == fileSize
|
||||
? _self.fileSize
|
||||
: fileSize // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
videoFileName: freezed == videoFileName
|
||||
? _self.videoFileName
|
||||
: videoFileName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
mediaSegments: freezed == mediaSegments
|
||||
? _self.mediaSegments
|
||||
: mediaSegments // ignore: cast_nullable_to_non_nullable
|
||||
as MediaSegmentsModel?,
|
||||
fTrickPlayModel: freezed == fTrickPlayModel
|
||||
? _self.fTrickPlayModel
|
||||
: fTrickPlayModel // ignore: cast_nullable_to_non_nullable
|
||||
as TrickPlayModel?,
|
||||
fImages: freezed == fImages
|
||||
? _self.fImages
|
||||
: fImages // ignore: cast_nullable_to_non_nullable
|
||||
as ImagesData?,
|
||||
fChapters: null == fChapters
|
||||
? _self._fChapters
|
||||
: fChapters // ignore: cast_nullable_to_non_nullable
|
||||
as List<Chapter>,
|
||||
subtitles: null == subtitles
|
||||
? _self._subtitles
|
||||
: subtitles // ignore: cast_nullable_to_non_nullable
|
||||
as List<SubStreamModel>,
|
||||
unSyncedData: null == unSyncedData
|
||||
? _self.unSyncedData
|
||||
: unSyncedData // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
userData: freezed == userData
|
||||
? _self.userData
|
||||
: userData // ignore: cast_nullable_to_non_nullable
|
||||
as UserData?,
|
||||
itemModel: freezed == itemModel
|
||||
? _self.itemModel
|
||||
: itemModel // ignore: cast_nullable_to_non_nullable
|
||||
as ItemBaseModel?,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of SyncedItem
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$SyncItemImplCopyWith<_$SyncItemImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
@pragma('vm:prefer-inline')
|
||||
$TrickPlayModelCopyWith<$Res>? get fTrickPlayModel {
|
||||
if (_self.fTrickPlayModel == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $TrickPlayModelCopyWith<$Res>(_self.fTrickPlayModel!, (value) {
|
||||
return _then(_self.copyWith(fTrickPlayModel: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import 'package:fladder/models/syncing/sync_item.dart';
|
|||
part 'sync_settings_model.freezed.dart';
|
||||
|
||||
@Freezed(toJson: false, fromJson: false, copyWith: true)
|
||||
class SyncSettingsModel with _$SyncSettingsModel {
|
||||
abstract class SyncSettingsModel with _$SyncSettingsModel {
|
||||
const SyncSettingsModel._();
|
||||
|
||||
factory SyncSettingsModel({
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// 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
|
||||
|
||||
|
|
@ -9,75 +9,43 @@ part of 'sync_settings_model.dart';
|
|||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(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 _$SyncSettingsModel {
|
||||
List<SyncedItem> get items => throw _privateConstructorUsedError;
|
||||
List<SyncedItem> get items;
|
||||
|
||||
/// Create a copy of SyncSettingsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$SyncSettingsModelCopyWith<SyncSettingsModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SyncSettingsModelCopyWith<$Res> {
|
||||
factory $SyncSettingsModelCopyWith(
|
||||
SyncSettingsModel value, $Res Function(SyncSettingsModel) then) =
|
||||
_$SyncSettingsModelCopyWithImpl<$Res, SyncSettingsModel>;
|
||||
@useResult
|
||||
$Res call({List<SyncedItem> items});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SyncSettingsModelCopyWithImpl<$Res, $Val extends SyncSettingsModel>
|
||||
implements $SyncSettingsModelCopyWith<$Res> {
|
||||
_$SyncSettingsModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of SyncSettingsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
$SyncSettingsModelCopyWith<SyncSettingsModel> get copyWith =>
|
||||
_$SyncSettingsModelCopyWithImpl<SyncSettingsModel>(
|
||||
this as SyncSettingsModel, _$identity);
|
||||
|
||||
@override
|
||||
$Res call({
|
||||
Object? items = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
items: null == items
|
||||
? _value.items
|
||||
: items // ignore: cast_nullable_to_non_nullable
|
||||
as List<SyncedItem>,
|
||||
) as $Val);
|
||||
String toString() {
|
||||
return 'SyncSettingsModel(items: $items)';
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SyncSettignsModelImplCopyWith<$Res>
|
||||
implements $SyncSettingsModelCopyWith<$Res> {
|
||||
factory _$$SyncSettignsModelImplCopyWith(_$SyncSettignsModelImpl value,
|
||||
$Res Function(_$SyncSettignsModelImpl) then) =
|
||||
__$$SyncSettignsModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
abstract mixin class $SyncSettingsModelCopyWith<$Res> {
|
||||
factory $SyncSettingsModelCopyWith(
|
||||
SyncSettingsModel value, $Res Function(SyncSettingsModel) _then) =
|
||||
_$SyncSettingsModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({List<SyncedItem> items});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SyncSettignsModelImplCopyWithImpl<$Res>
|
||||
extends _$SyncSettingsModelCopyWithImpl<$Res, _$SyncSettignsModelImpl>
|
||||
implements _$$SyncSettignsModelImplCopyWith<$Res> {
|
||||
__$$SyncSettignsModelImplCopyWithImpl(_$SyncSettignsModelImpl _value,
|
||||
$Res Function(_$SyncSettignsModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
class _$SyncSettingsModelCopyWithImpl<$Res>
|
||||
implements $SyncSettingsModelCopyWith<$Res> {
|
||||
_$SyncSettingsModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final SyncSettingsModel _self;
|
||||
final $Res Function(SyncSettingsModel) _then;
|
||||
|
||||
/// Create a copy of SyncSettingsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
|
@ -86,19 +54,176 @@ class __$$SyncSettignsModelImplCopyWithImpl<$Res>
|
|||
$Res call({
|
||||
Object? items = null,
|
||||
}) {
|
||||
return _then(_$SyncSettignsModelImpl(
|
||||
return _then(_self.copyWith(
|
||||
items: null == items
|
||||
? _value._items
|
||||
? _self.items
|
||||
: items // ignore: cast_nullable_to_non_nullable
|
||||
as List<SyncedItem>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [SyncSettingsModel].
|
||||
extension SyncSettingsModelPatterns on SyncSettingsModel {
|
||||
/// 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(_SyncSettignsModel value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncSettignsModel() 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(_SyncSettignsModel value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncSettignsModel():
|
||||
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(_SyncSettignsModel value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncSettignsModel() 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(List<SyncedItem> items)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncSettignsModel() when $default != null:
|
||||
return $default(_that.items);
|
||||
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(List<SyncedItem> items) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncSettignsModel():
|
||||
return $default(_that.items);
|
||||
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(List<SyncedItem> items)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SyncSettignsModel() when $default != null:
|
||||
return $default(_that.items);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SyncSettignsModelImpl extends _SyncSettignsModel {
|
||||
_$SyncSettignsModelImpl({final List<SyncedItem> items = const []})
|
||||
class _SyncSettignsModel extends SyncSettingsModel {
|
||||
_SyncSettignsModel({final List<SyncedItem> items = const []})
|
||||
: _items = items,
|
||||
super._();
|
||||
|
||||
|
|
@ -111,33 +236,53 @@ class _$SyncSettignsModelImpl extends _SyncSettignsModel {
|
|||
return EqualUnmodifiableListView(_items);
|
||||
}
|
||||
|
||||
/// Create a copy of SyncSettingsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$SyncSettignsModelCopyWith<_SyncSettignsModel> get copyWith =>
|
||||
__$SyncSettignsModelCopyWithImpl<_SyncSettignsModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SyncSettingsModel(items: $items)';
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$SyncSettignsModelCopyWith<$Res>
|
||||
implements $SyncSettingsModelCopyWith<$Res> {
|
||||
factory _$SyncSettignsModelCopyWith(
|
||||
_SyncSettignsModel value, $Res Function(_SyncSettignsModel) _then) =
|
||||
__$SyncSettignsModelCopyWithImpl;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({List<SyncedItem> items});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$SyncSettignsModelCopyWithImpl<$Res>
|
||||
implements _$SyncSettignsModelCopyWith<$Res> {
|
||||
__$SyncSettignsModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _SyncSettignsModel _self;
|
||||
final $Res Function(_SyncSettignsModel) _then;
|
||||
|
||||
/// Create a copy of SyncSettingsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SyncSettignsModelImplCopyWith<_$SyncSettignsModelImpl> get copyWith =>
|
||||
__$$SyncSettignsModelImplCopyWithImpl<_$SyncSettignsModelImpl>(
|
||||
this, _$identity);
|
||||
$Res call({
|
||||
Object? items = null,
|
||||
}) {
|
||||
return _then(_SyncSettignsModel(
|
||||
items: null == items
|
||||
? _self._items
|
||||
: items // ignore: cast_nullable_to_non_nullable
|
||||
as List<SyncedItem>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _SyncSettignsModel extends SyncSettingsModel {
|
||||
factory _SyncSettignsModel({final List<SyncedItem> items}) =
|
||||
_$SyncSettignsModelImpl;
|
||||
_SyncSettignsModel._() : super._();
|
||||
|
||||
@override
|
||||
List<SyncedItem> get items;
|
||||
|
||||
/// Create a copy of SyncSettingsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$SyncSettignsModelImplCopyWith<_$SyncSettignsModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
// dart format on
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue