chore: Update Flutter version and dependencies

This commit is contained in:
2026-03-08 14:10:50 +01:00
parent 4c5fa10ffd
commit 6c504e0125
19 changed files with 2578 additions and 1243 deletions

View File

@@ -17,7 +17,7 @@ class BoolConverter implements JsonConverter<bool, int> {
/// Data about a tracked anime
@freezed
class AnimeTrackingData with _$AnimeTrackingData, TrackingMedium {
abstract class AnimeTrackingData with _$AnimeTrackingData, TrackingMedium {
factory AnimeTrackingData(
/// The ID of the anime
String id,
@@ -44,6 +44,8 @@ class AnimeTrackingData with _$AnimeTrackingData, TrackingMedium {
String? broadcastDay,
) = _AnimeTrackingData;
AnimeTrackingData._();
/// JSON
factory AnimeTrackingData.fromJson(Map<String, dynamic> json) =>
_$AnimeTrackingDataFromJson(json);

View File

@@ -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,138 +9,83 @@ part of 'anime.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');
AnimeTrackingData _$AnimeTrackingDataFromJson(Map<String, dynamic> json) {
return _AnimeTrackingData.fromJson(json);
}
/// @nodoc
mixin _$AnimeTrackingData {
/// The ID of the anime
String get id => throw _privateConstructorUsedError;
String get id;
/// The state of the anime
@MediumTrackingStateConverter()
MediumTrackingState get state => throw _privateConstructorUsedError;
MediumTrackingState get state;
/// The title of the anime
String get title => throw _privateConstructorUsedError;
String get title;
/// Episodes in total.
int get episodesWatched => throw _privateConstructorUsedError;
int get episodesWatched;
/// Episodes watched.
int? get episodesTotal => throw _privateConstructorUsedError;
int? get episodesTotal;
/// URL to the thumbnail/cover art for the anime.
String get thumbnailUrl => throw _privateConstructorUsedError;
String get thumbnailUrl;
/// Flag whether the anime is airing
@BoolConverter()
bool get airing => throw _privateConstructorUsedError;
bool get airing;
/// The day of the week the anime is airing
String? get broadcastDay => throw _privateConstructorUsedError;
/// Serializes this AnimeTrackingData to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
String? get broadcastDay;
/// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$AnimeTrackingDataCopyWith<AnimeTrackingData> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AnimeTrackingDataCopyWith<$Res> {
factory $AnimeTrackingDataCopyWith(
AnimeTrackingData value, $Res Function(AnimeTrackingData) then) =
_$AnimeTrackingDataCopyWithImpl<$Res, AnimeTrackingData>;
@useResult
$Res call(
{String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int episodesWatched,
int? episodesTotal,
String thumbnailUrl,
@BoolConverter() bool airing,
String? broadcastDay});
}
/// @nodoc
class _$AnimeTrackingDataCopyWithImpl<$Res, $Val extends AnimeTrackingData>
implements $AnimeTrackingDataCopyWith<$Res> {
_$AnimeTrackingDataCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
$AnimeTrackingDataCopyWith<AnimeTrackingData> get copyWith =>
_$AnimeTrackingDataCopyWithImpl<AnimeTrackingData>(
this as AnimeTrackingData, _$identity);
/// Serializes this AnimeTrackingData to a JSON map.
Map<String, dynamic> toJson();
@override
$Res call({
Object? id = null,
Object? state = null,
Object? title = null,
Object? episodesWatched = null,
Object? episodesTotal = freezed,
Object? thumbnailUrl = null,
Object? airing = null,
Object? broadcastDay = freezed,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
state: null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
episodesWatched: null == episodesWatched
? _value.episodesWatched
: episodesWatched // ignore: cast_nullable_to_non_nullable
as int,
episodesTotal: freezed == episodesTotal
? _value.episodesTotal
: episodesTotal // ignore: cast_nullable_to_non_nullable
as int?,
thumbnailUrl: null == thumbnailUrl
? _value.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String,
airing: null == airing
? _value.airing
: airing // ignore: cast_nullable_to_non_nullable
as bool,
broadcastDay: freezed == broadcastDay
? _value.broadcastDay
: broadcastDay // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is AnimeTrackingData &&
(identical(other.id, id) || other.id == id) &&
(identical(other.state, state) || other.state == state) &&
(identical(other.title, title) || other.title == title) &&
(identical(other.episodesWatched, episodesWatched) ||
other.episodesWatched == episodesWatched) &&
(identical(other.episodesTotal, episodesTotal) ||
other.episodesTotal == episodesTotal) &&
(identical(other.thumbnailUrl, thumbnailUrl) ||
other.thumbnailUrl == thumbnailUrl) &&
(identical(other.airing, airing) || other.airing == airing) &&
(identical(other.broadcastDay, broadcastDay) ||
other.broadcastDay == broadcastDay));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, state, title,
episodesWatched, episodesTotal, thumbnailUrl, airing, broadcastDay);
@override
String toString() {
return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay)';
}
}
/// @nodoc
abstract class _$$AnimeTrackingDataImplCopyWith<$Res>
implements $AnimeTrackingDataCopyWith<$Res> {
factory _$$AnimeTrackingDataImplCopyWith(_$AnimeTrackingDataImpl value,
$Res Function(_$AnimeTrackingDataImpl) then) =
__$$AnimeTrackingDataImplCopyWithImpl<$Res>;
@override
abstract mixin class $AnimeTrackingDataCopyWith<$Res> {
factory $AnimeTrackingDataCopyWith(
AnimeTrackingData value, $Res Function(AnimeTrackingData) _then) =
_$AnimeTrackingDataCopyWithImpl;
@useResult
$Res call(
{String id,
@@ -154,12 +99,12 @@ abstract class _$$AnimeTrackingDataImplCopyWith<$Res>
}
/// @nodoc
class __$$AnimeTrackingDataImplCopyWithImpl<$Res>
extends _$AnimeTrackingDataCopyWithImpl<$Res, _$AnimeTrackingDataImpl>
implements _$$AnimeTrackingDataImplCopyWith<$Res> {
__$$AnimeTrackingDataImplCopyWithImpl(_$AnimeTrackingDataImpl _value,
$Res Function(_$AnimeTrackingDataImpl) _then)
: super(_value, _then);
class _$AnimeTrackingDataCopyWithImpl<$Res>
implements $AnimeTrackingDataCopyWith<$Res> {
_$AnimeTrackingDataCopyWithImpl(this._self, this._then);
final AnimeTrackingData _self;
final $Res Function(AnimeTrackingData) _then;
/// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values.
@@ -175,47 +120,255 @@ class __$$AnimeTrackingDataImplCopyWithImpl<$Res>
Object? airing = null,
Object? broadcastDay = freezed,
}) {
return _then(_$AnimeTrackingDataImpl(
null == id
? _value.id
return _then(_self.copyWith(
id: null == id
? _self.id
: id // ignore: cast_nullable_to_non_nullable
as String,
null == state
? _value.state
state: null == state
? _self.state
: state // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
null == title
? _value.title
title: null == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
null == episodesWatched
? _value.episodesWatched
episodesWatched: null == episodesWatched
? _self.episodesWatched
: episodesWatched // ignore: cast_nullable_to_non_nullable
as int,
freezed == episodesTotal
? _value.episodesTotal
episodesTotal: freezed == episodesTotal
? _self.episodesTotal
: episodesTotal // ignore: cast_nullable_to_non_nullable
as int?,
null == thumbnailUrl
? _value.thumbnailUrl
thumbnailUrl: null == thumbnailUrl
? _self.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String,
null == airing
? _value.airing
airing: null == airing
? _self.airing
: airing // ignore: cast_nullable_to_non_nullable
as bool,
freezed == broadcastDay
? _value.broadcastDay
broadcastDay: freezed == broadcastDay
? _self.broadcastDay
: broadcastDay // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [AnimeTrackingData].
extension AnimeTrackingDataPatterns on AnimeTrackingData {
/// 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(_AnimeTrackingData value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _AnimeTrackingData() 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(_AnimeTrackingData value) $default,
) {
final _that = this;
switch (_that) {
case _AnimeTrackingData():
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(_AnimeTrackingData value)? $default,
) {
final _that = this;
switch (_that) {
case _AnimeTrackingData() 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,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int episodesWatched,
int? episodesTotal,
String thumbnailUrl,
@BoolConverter() bool airing,
String? broadcastDay)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _AnimeTrackingData() when $default != null:
return $default(
_that.id,
_that.state,
_that.title,
_that.episodesWatched,
_that.episodesTotal,
_that.thumbnailUrl,
_that.airing,
_that.broadcastDay);
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,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int episodesWatched,
int? episodesTotal,
String thumbnailUrl,
@BoolConverter() bool airing,
String? broadcastDay)
$default,
) {
final _that = this;
switch (_that) {
case _AnimeTrackingData():
return $default(
_that.id,
_that.state,
_that.title,
_that.episodesWatched,
_that.episodesTotal,
_that.thumbnailUrl,
_that.airing,
_that.broadcastDay);
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,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int episodesWatched,
int? episodesTotal,
String thumbnailUrl,
@BoolConverter() bool airing,
String? broadcastDay)?
$default,
) {
final _that = this;
switch (_that) {
case _AnimeTrackingData() when $default != null:
return $default(
_that.id,
_that.state,
_that.title,
_that.episodesWatched,
_that.episodesTotal,
_that.thumbnailUrl,
_that.airing,
_that.broadcastDay);
case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _$AnimeTrackingDataImpl implements _AnimeTrackingData {
_$AnimeTrackingDataImpl(
class _AnimeTrackingData extends AnimeTrackingData {
_AnimeTrackingData(
this.id,
@MediumTrackingStateConverter() this.state,
this.title,
@@ -223,10 +376,10 @@ class _$AnimeTrackingDataImpl implements _AnimeTrackingData {
this.episodesTotal,
this.thumbnailUrl,
@BoolConverter() this.airing,
this.broadcastDay);
factory _$AnimeTrackingDataImpl.fromJson(Map<String, dynamic> json) =>
_$$AnimeTrackingDataImplFromJson(json);
this.broadcastDay)
: super._();
factory _AnimeTrackingData.fromJson(Map<String, dynamic> json) =>
_$AnimeTrackingDataFromJson(json);
/// The ID of the anime
@override
@@ -262,16 +415,26 @@ class _$AnimeTrackingDataImpl implements _AnimeTrackingData {
@override
final String? broadcastDay;
/// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values.
@override
String toString() {
return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay)';
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AnimeTrackingDataCopyWith<_AnimeTrackingData> get copyWith =>
__$AnimeTrackingDataCopyWithImpl<_AnimeTrackingData>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$AnimeTrackingDataToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$AnimeTrackingDataImpl &&
other is _AnimeTrackingData &&
(identical(other.id, id) || other.id == id) &&
(identical(other.state, state) || other.state == state) &&
(identical(other.title, title) || other.title == title) &&
@@ -291,75 +454,88 @@ class _$AnimeTrackingDataImpl implements _AnimeTrackingData {
int get hashCode => Object.hash(runtimeType, id, state, title,
episodesWatched, episodesTotal, thumbnailUrl, airing, broadcastDay);
/// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$AnimeTrackingDataImplCopyWith<_$AnimeTrackingDataImpl> get copyWith =>
__$$AnimeTrackingDataImplCopyWithImpl<_$AnimeTrackingDataImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$AnimeTrackingDataImplToJson(
this,
);
String toString() {
return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay)';
}
}
abstract class _AnimeTrackingData implements AnimeTrackingData {
factory _AnimeTrackingData(
final String id,
@MediumTrackingStateConverter() final MediumTrackingState state,
final String title,
final int episodesWatched,
final int? episodesTotal,
final String thumbnailUrl,
@BoolConverter() final bool airing,
final String? broadcastDay) = _$AnimeTrackingDataImpl;
factory _AnimeTrackingData.fromJson(Map<String, dynamic> json) =
_$AnimeTrackingDataImpl.fromJson;
/// The ID of the anime
/// @nodoc
abstract mixin class _$AnimeTrackingDataCopyWith<$Res>
implements $AnimeTrackingDataCopyWith<$Res> {
factory _$AnimeTrackingDataCopyWith(
_AnimeTrackingData value, $Res Function(_AnimeTrackingData) _then) =
__$AnimeTrackingDataCopyWithImpl;
@override
String get id;
@useResult
$Res call(
{String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int episodesWatched,
int? episodesTotal,
String thumbnailUrl,
@BoolConverter() bool airing,
String? broadcastDay});
}
/// The state of the anime
@override
@MediumTrackingStateConverter()
MediumTrackingState get state;
/// @nodoc
class __$AnimeTrackingDataCopyWithImpl<$Res>
implements _$AnimeTrackingDataCopyWith<$Res> {
__$AnimeTrackingDataCopyWithImpl(this._self, this._then);
/// The title of the anime
@override
String get title;
/// Episodes in total.
@override
int get episodesWatched;
/// Episodes watched.
@override
int? get episodesTotal;
/// URL to the thumbnail/cover art for the anime.
@override
String get thumbnailUrl;
/// Flag whether the anime is airing
@override
@BoolConverter()
bool get airing;
/// The day of the week the anime is airing
@override
String? get broadcastDay;
final _AnimeTrackingData _self;
final $Res Function(_AnimeTrackingData) _then;
/// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$AnimeTrackingDataImplCopyWith<_$AnimeTrackingDataImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
$Res call({
Object? id = null,
Object? state = null,
Object? title = null,
Object? episodesWatched = null,
Object? episodesTotal = freezed,
Object? thumbnailUrl = null,
Object? airing = null,
Object? broadcastDay = freezed,
}) {
return _then(_AnimeTrackingData(
null == id
? _self.id
: id // ignore: cast_nullable_to_non_nullable
as String,
null == state
? _self.state
: state // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
null == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
null == episodesWatched
? _self.episodesWatched
: episodesWatched // ignore: cast_nullable_to_non_nullable
as int,
freezed == episodesTotal
? _self.episodesTotal
: episodesTotal // ignore: cast_nullable_to_non_nullable
as int?,
null == thumbnailUrl
? _self.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String,
null == airing
? _self.airing
: airing // ignore: cast_nullable_to_non_nullable
as bool,
freezed == broadcastDay
? _self.broadcastDay
: broadcastDay // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -6,9 +6,8 @@ part of 'anime.dart';
// JsonSerializableGenerator
// **************************************************************************
_$AnimeTrackingDataImpl _$$AnimeTrackingDataImplFromJson(
Map<String, dynamic> json) =>
_$AnimeTrackingDataImpl(
_AnimeTrackingData _$AnimeTrackingDataFromJson(Map<String, dynamic> json) =>
_AnimeTrackingData(
json['id'] as String,
const MediumTrackingStateConverter()
.fromJson((json['state'] as num).toInt()),
@@ -20,8 +19,7 @@ _$AnimeTrackingDataImpl _$$AnimeTrackingDataImplFromJson(
json['broadcastDay'] as String?,
);
Map<String, dynamic> _$$AnimeTrackingDataImplToJson(
_$AnimeTrackingDataImpl instance) =>
Map<String, dynamic> _$AnimeTrackingDataToJson(_AnimeTrackingData instance) =>
<String, dynamic>{
'id': instance.id,
'state': const MediumTrackingStateConverter().toJson(instance.state),

View File

@@ -6,7 +6,7 @@ part 'manga.g.dart';
/// Data about a tracked anime
@freezed
class MangaTrackingData with _$MangaTrackingData, TrackingMedium {
abstract class MangaTrackingData with _$MangaTrackingData, TrackingMedium {
factory MangaTrackingData(
/// The ID of the manga
String id,
@@ -30,6 +30,8 @@ class MangaTrackingData with _$MangaTrackingData, TrackingMedium {
String thumbnailUrl,
) = _MangaTrackingData;
MangaTrackingData._();
/// JSON
factory MangaTrackingData.fromJson(Map<String, dynamic> json) =>
_$MangaTrackingDataFromJson(json);

View File

@@ -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,128 +9,78 @@ part of 'manga.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');
MangaTrackingData _$MangaTrackingDataFromJson(Map<String, dynamic> json) {
return _MangaTrackingData.fromJson(json);
}
/// @nodoc
mixin _$MangaTrackingData {
/// The ID of the manga
String get id => throw _privateConstructorUsedError;
String get id;
/// The state of the manga
@MediumTrackingStateConverter()
MediumTrackingState get state => throw _privateConstructorUsedError;
MediumTrackingState get state;
/// The title of the manga
String get title => throw _privateConstructorUsedError;
String get title;
/// Chapters read.
int get chaptersRead => throw _privateConstructorUsedError;
int get chaptersRead;
/// Chapters read.
int get volumesOwned => throw _privateConstructorUsedError;
int get volumesOwned;
/// Episodes watched.
int? get chaptersTotal => throw _privateConstructorUsedError;
int? get chaptersTotal;
/// URL to the thumbnail/cover art for the manga.
String get thumbnailUrl => throw _privateConstructorUsedError;
/// Serializes this MangaTrackingData to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
String get thumbnailUrl;
/// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$MangaTrackingDataCopyWith<MangaTrackingData> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $MangaTrackingDataCopyWith<$Res> {
factory $MangaTrackingDataCopyWith(
MangaTrackingData value, $Res Function(MangaTrackingData) then) =
_$MangaTrackingDataCopyWithImpl<$Res, MangaTrackingData>;
@useResult
$Res call(
{String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int chaptersRead,
int volumesOwned,
int? chaptersTotal,
String thumbnailUrl});
}
/// @nodoc
class _$MangaTrackingDataCopyWithImpl<$Res, $Val extends MangaTrackingData>
implements $MangaTrackingDataCopyWith<$Res> {
_$MangaTrackingDataCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
$MangaTrackingDataCopyWith<MangaTrackingData> get copyWith =>
_$MangaTrackingDataCopyWithImpl<MangaTrackingData>(
this as MangaTrackingData, _$identity);
/// Serializes this MangaTrackingData to a JSON map.
Map<String, dynamic> toJson();
@override
$Res call({
Object? id = null,
Object? state = null,
Object? title = null,
Object? chaptersRead = null,
Object? volumesOwned = null,
Object? chaptersTotal = freezed,
Object? thumbnailUrl = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
state: null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
chaptersRead: null == chaptersRead
? _value.chaptersRead
: chaptersRead // ignore: cast_nullable_to_non_nullable
as int,
volumesOwned: null == volumesOwned
? _value.volumesOwned
: volumesOwned // ignore: cast_nullable_to_non_nullable
as int,
chaptersTotal: freezed == chaptersTotal
? _value.chaptersTotal
: chaptersTotal // ignore: cast_nullable_to_non_nullable
as int?,
thumbnailUrl: null == thumbnailUrl
? _value.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is MangaTrackingData &&
(identical(other.id, id) || other.id == id) &&
(identical(other.state, state) || other.state == state) &&
(identical(other.title, title) || other.title == title) &&
(identical(other.chaptersRead, chaptersRead) ||
other.chaptersRead == chaptersRead) &&
(identical(other.volumesOwned, volumesOwned) ||
other.volumesOwned == volumesOwned) &&
(identical(other.chaptersTotal, chaptersTotal) ||
other.chaptersTotal == chaptersTotal) &&
(identical(other.thumbnailUrl, thumbnailUrl) ||
other.thumbnailUrl == thumbnailUrl));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, state, title, chaptersRead,
volumesOwned, chaptersTotal, thumbnailUrl);
@override
String toString() {
return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl)';
}
}
/// @nodoc
abstract class _$$MangaTrackingDataImplCopyWith<$Res>
implements $MangaTrackingDataCopyWith<$Res> {
factory _$$MangaTrackingDataImplCopyWith(_$MangaTrackingDataImpl value,
$Res Function(_$MangaTrackingDataImpl) then) =
__$$MangaTrackingDataImplCopyWithImpl<$Res>;
@override
abstract mixin class $MangaTrackingDataCopyWith<$Res> {
factory $MangaTrackingDataCopyWith(
MangaTrackingData value, $Res Function(MangaTrackingData) _then) =
_$MangaTrackingDataCopyWithImpl;
@useResult
$Res call(
{String id,
@@ -143,12 +93,12 @@ abstract class _$$MangaTrackingDataImplCopyWith<$Res>
}
/// @nodoc
class __$$MangaTrackingDataImplCopyWithImpl<$Res>
extends _$MangaTrackingDataCopyWithImpl<$Res, _$MangaTrackingDataImpl>
implements _$$MangaTrackingDataImplCopyWith<$Res> {
__$$MangaTrackingDataImplCopyWithImpl(_$MangaTrackingDataImpl _value,
$Res Function(_$MangaTrackingDataImpl) _then)
: super(_value, _then);
class _$MangaTrackingDataCopyWithImpl<$Res>
implements $MangaTrackingDataCopyWith<$Res> {
_$MangaTrackingDataCopyWithImpl(this._self, this._then);
final MangaTrackingData _self;
final $Res Function(MangaTrackingData) _then;
/// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values.
@@ -163,53 +113,237 @@ class __$$MangaTrackingDataImplCopyWithImpl<$Res>
Object? chaptersTotal = freezed,
Object? thumbnailUrl = null,
}) {
return _then(_$MangaTrackingDataImpl(
null == id
? _value.id
return _then(_self.copyWith(
id: null == id
? _self.id
: id // ignore: cast_nullable_to_non_nullable
as String,
null == state
? _value.state
state: null == state
? _self.state
: state // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
null == title
? _value.title
title: null == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
null == chaptersRead
? _value.chaptersRead
chaptersRead: null == chaptersRead
? _self.chaptersRead
: chaptersRead // ignore: cast_nullable_to_non_nullable
as int,
null == volumesOwned
? _value.volumesOwned
volumesOwned: null == volumesOwned
? _self.volumesOwned
: volumesOwned // ignore: cast_nullable_to_non_nullable
as int,
freezed == chaptersTotal
? _value.chaptersTotal
chaptersTotal: freezed == chaptersTotal
? _self.chaptersTotal
: chaptersTotal // ignore: cast_nullable_to_non_nullable
as int?,
null == thumbnailUrl
? _value.thumbnailUrl
thumbnailUrl: null == thumbnailUrl
? _self.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [MangaTrackingData].
extension MangaTrackingDataPatterns on MangaTrackingData {
/// 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(_MangaTrackingData value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _MangaTrackingData() 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(_MangaTrackingData value) $default,
) {
final _that = this;
switch (_that) {
case _MangaTrackingData():
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(_MangaTrackingData value)? $default,
) {
final _that = this;
switch (_that) {
case _MangaTrackingData() 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,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int chaptersRead,
int volumesOwned,
int? chaptersTotal,
String thumbnailUrl)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _MangaTrackingData() when $default != null:
return $default(_that.id, _that.state, _that.title, _that.chaptersRead,
_that.volumesOwned, _that.chaptersTotal, _that.thumbnailUrl);
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,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int chaptersRead,
int volumesOwned,
int? chaptersTotal,
String thumbnailUrl)
$default,
) {
final _that = this;
switch (_that) {
case _MangaTrackingData():
return $default(_that.id, _that.state, _that.title, _that.chaptersRead,
_that.volumesOwned, _that.chaptersTotal, _that.thumbnailUrl);
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,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int chaptersRead,
int volumesOwned,
int? chaptersTotal,
String thumbnailUrl)?
$default,
) {
final _that = this;
switch (_that) {
case _MangaTrackingData() when $default != null:
return $default(_that.id, _that.state, _that.title, _that.chaptersRead,
_that.volumesOwned, _that.chaptersTotal, _that.thumbnailUrl);
case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _$MangaTrackingDataImpl implements _MangaTrackingData {
_$MangaTrackingDataImpl(
class _MangaTrackingData extends MangaTrackingData {
_MangaTrackingData(
this.id,
@MediumTrackingStateConverter() this.state,
this.title,
this.chaptersRead,
this.volumesOwned,
this.chaptersTotal,
this.thumbnailUrl);
factory _$MangaTrackingDataImpl.fromJson(Map<String, dynamic> json) =>
_$$MangaTrackingDataImplFromJson(json);
this.thumbnailUrl)
: super._();
factory _MangaTrackingData.fromJson(Map<String, dynamic> json) =>
_$MangaTrackingDataFromJson(json);
/// The ID of the manga
@override
@@ -240,16 +374,26 @@ class _$MangaTrackingDataImpl implements _MangaTrackingData {
@override
final String thumbnailUrl;
/// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values.
@override
String toString() {
return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl)';
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$MangaTrackingDataCopyWith<_MangaTrackingData> get copyWith =>
__$MangaTrackingDataCopyWithImpl<_MangaTrackingData>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$MangaTrackingDataToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$MangaTrackingDataImpl &&
other is _MangaTrackingData &&
(identical(other.id, id) || other.id == id) &&
(identical(other.state, state) || other.state == state) &&
(identical(other.title, title) || other.title == title) &&
@@ -268,69 +412,82 @@ class _$MangaTrackingDataImpl implements _MangaTrackingData {
int get hashCode => Object.hash(runtimeType, id, state, title, chaptersRead,
volumesOwned, chaptersTotal, thumbnailUrl);
/// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$MangaTrackingDataImplCopyWith<_$MangaTrackingDataImpl> get copyWith =>
__$$MangaTrackingDataImplCopyWithImpl<_$MangaTrackingDataImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$MangaTrackingDataImplToJson(
this,
);
String toString() {
return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl)';
}
}
abstract class _MangaTrackingData implements MangaTrackingData {
factory _MangaTrackingData(
final String id,
@MediumTrackingStateConverter() final MediumTrackingState state,
final String title,
final int chaptersRead,
final int volumesOwned,
final int? chaptersTotal,
final String thumbnailUrl) = _$MangaTrackingDataImpl;
factory _MangaTrackingData.fromJson(Map<String, dynamic> json) =
_$MangaTrackingDataImpl.fromJson;
/// The ID of the manga
/// @nodoc
abstract mixin class _$MangaTrackingDataCopyWith<$Res>
implements $MangaTrackingDataCopyWith<$Res> {
factory _$MangaTrackingDataCopyWith(
_MangaTrackingData value, $Res Function(_MangaTrackingData) _then) =
__$MangaTrackingDataCopyWithImpl;
@override
String get id;
@useResult
$Res call(
{String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int chaptersRead,
int volumesOwned,
int? chaptersTotal,
String thumbnailUrl});
}
/// The state of the manga
@override
@MediumTrackingStateConverter()
MediumTrackingState get state;
/// @nodoc
class __$MangaTrackingDataCopyWithImpl<$Res>
implements _$MangaTrackingDataCopyWith<$Res> {
__$MangaTrackingDataCopyWithImpl(this._self, this._then);
/// The title of the manga
@override
String get title;
/// Chapters read.
@override
int get chaptersRead;
/// Chapters read.
@override
int get volumesOwned;
/// Episodes watched.
@override
int? get chaptersTotal;
/// URL to the thumbnail/cover art for the manga.
@override
String get thumbnailUrl;
final _MangaTrackingData _self;
final $Res Function(_MangaTrackingData) _then;
/// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$MangaTrackingDataImplCopyWith<_$MangaTrackingDataImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
$Res call({
Object? id = null,
Object? state = null,
Object? title = null,
Object? chaptersRead = null,
Object? volumesOwned = null,
Object? chaptersTotal = freezed,
Object? thumbnailUrl = null,
}) {
return _then(_MangaTrackingData(
null == id
? _self.id
: id // ignore: cast_nullable_to_non_nullable
as String,
null == state
? _self.state
: state // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
null == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
null == chaptersRead
? _self.chaptersRead
: chaptersRead // ignore: cast_nullable_to_non_nullable
as int,
null == volumesOwned
? _self.volumesOwned
: volumesOwned // ignore: cast_nullable_to_non_nullable
as int,
freezed == chaptersTotal
? _self.chaptersTotal
: chaptersTotal // ignore: cast_nullable_to_non_nullable
as int?,
null == thumbnailUrl
? _self.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -6,9 +6,8 @@ part of 'manga.dart';
// JsonSerializableGenerator
// **************************************************************************
_$MangaTrackingDataImpl _$$MangaTrackingDataImplFromJson(
Map<String, dynamic> json) =>
_$MangaTrackingDataImpl(
_MangaTrackingData _$MangaTrackingDataFromJson(Map<String, dynamic> json) =>
_MangaTrackingData(
json['id'] as String,
const MediumTrackingStateConverter()
.fromJson((json['state'] as num).toInt()),
@@ -19,8 +18,7 @@ _$MangaTrackingDataImpl _$$MangaTrackingDataImplFromJson(
json['thumbnailUrl'] as String,
);
Map<String, dynamic> _$$MangaTrackingDataImplToJson(
_$MangaTrackingDataImpl instance) =>
Map<String, dynamic> _$MangaTrackingDataToJson(_MangaTrackingData instance) =>
<String, dynamic>{
'id': instance.id,
'state': const MediumTrackingStateConverter().toJson(instance.state),

View File

@@ -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,102 +9,64 @@ part of 'anime_list_bloc.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 _$AnimeListState {
bool get buttonVisibility => throw _privateConstructorUsedError;
List<AnimeTrackingData> get animes => throw _privateConstructorUsedError;
List<MangaTrackingData> get mangas => throw _privateConstructorUsedError;
MediumTrackingState get animeFilterState =>
throw _privateConstructorUsedError;
MediumTrackingState get mangaFilterState =>
throw _privateConstructorUsedError;
TrackingMediumType get trackingType => throw _privateConstructorUsedError;
bool get buttonVisibility;
List<AnimeTrackingData> get animes;
List<MangaTrackingData> get mangas;
MediumTrackingState get animeFilterState;
MediumTrackingState get mangaFilterState;
TrackingMediumType get trackingType;
/// Create a copy of AnimeListState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$AnimeListStateCopyWith<AnimeListState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AnimeListStateCopyWith<$Res> {
factory $AnimeListStateCopyWith(
AnimeListState value, $Res Function(AnimeListState) then) =
_$AnimeListStateCopyWithImpl<$Res, AnimeListState>;
@useResult
$Res call(
{bool buttonVisibility,
List<AnimeTrackingData> animes,
List<MangaTrackingData> mangas,
MediumTrackingState animeFilterState,
MediumTrackingState mangaFilterState,
TrackingMediumType trackingType});
}
/// @nodoc
class _$AnimeListStateCopyWithImpl<$Res, $Val extends AnimeListState>
implements $AnimeListStateCopyWith<$Res> {
_$AnimeListStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of AnimeListState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
$AnimeListStateCopyWith<AnimeListState> get copyWith =>
_$AnimeListStateCopyWithImpl<AnimeListState>(
this as AnimeListState, _$identity);
@override
$Res call({
Object? buttonVisibility = null,
Object? animes = null,
Object? mangas = null,
Object? animeFilterState = null,
Object? mangaFilterState = null,
Object? trackingType = null,
}) {
return _then(_value.copyWith(
buttonVisibility: null == buttonVisibility
? _value.buttonVisibility
: buttonVisibility // ignore: cast_nullable_to_non_nullable
as bool,
animes: null == animes
? _value.animes
: animes // ignore: cast_nullable_to_non_nullable
as List<AnimeTrackingData>,
mangas: null == mangas
? _value.mangas
: mangas // ignore: cast_nullable_to_non_nullable
as List<MangaTrackingData>,
animeFilterState: null == animeFilterState
? _value.animeFilterState
: animeFilterState // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
mangaFilterState: null == mangaFilterState
? _value.mangaFilterState
: mangaFilterState // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
trackingType: null == trackingType
? _value.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType,
) as $Val);
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is AnimeListState &&
(identical(other.buttonVisibility, buttonVisibility) ||
other.buttonVisibility == buttonVisibility) &&
const DeepCollectionEquality().equals(other.animes, animes) &&
const DeepCollectionEquality().equals(other.mangas, mangas) &&
(identical(other.animeFilterState, animeFilterState) ||
other.animeFilterState == animeFilterState) &&
(identical(other.mangaFilterState, mangaFilterState) ||
other.mangaFilterState == mangaFilterState) &&
(identical(other.trackingType, trackingType) ||
other.trackingType == trackingType));
}
@override
int get hashCode => Object.hash(
runtimeType,
buttonVisibility,
const DeepCollectionEquality().hash(animes),
const DeepCollectionEquality().hash(mangas),
animeFilterState,
mangaFilterState,
trackingType);
@override
String toString() {
return 'AnimeListState(buttonVisibility: $buttonVisibility, animes: $animes, mangas: $mangas, animeFilterState: $animeFilterState, mangaFilterState: $mangaFilterState, trackingType: $trackingType)';
}
}
/// @nodoc
abstract class _$$AnimeListStateImplCopyWith<$Res>
implements $AnimeListStateCopyWith<$Res> {
factory _$$AnimeListStateImplCopyWith(_$AnimeListStateImpl value,
$Res Function(_$AnimeListStateImpl) then) =
__$$AnimeListStateImplCopyWithImpl<$Res>;
@override
abstract mixin class $AnimeListStateCopyWith<$Res> {
factory $AnimeListStateCopyWith(
AnimeListState value, $Res Function(AnimeListState) _then) =
_$AnimeListStateCopyWithImpl;
@useResult
$Res call(
{bool buttonVisibility,
@@ -116,12 +78,12 @@ abstract class _$$AnimeListStateImplCopyWith<$Res>
}
/// @nodoc
class __$$AnimeListStateImplCopyWithImpl<$Res>
extends _$AnimeListStateCopyWithImpl<$Res, _$AnimeListStateImpl>
implements _$$AnimeListStateImplCopyWith<$Res> {
__$$AnimeListStateImplCopyWithImpl(
_$AnimeListStateImpl _value, $Res Function(_$AnimeListStateImpl) _then)
: super(_value, _then);
class _$AnimeListStateCopyWithImpl<$Res>
implements $AnimeListStateCopyWith<$Res> {
_$AnimeListStateCopyWithImpl(this._self, this._then);
final AnimeListState _self;
final $Res Function(AnimeListState) _then;
/// Create a copy of AnimeListState
/// with the given fields replaced by the non-null parameter values.
@@ -135,39 +97,220 @@ class __$$AnimeListStateImplCopyWithImpl<$Res>
Object? mangaFilterState = null,
Object? trackingType = null,
}) {
return _then(_$AnimeListStateImpl(
return _then(_self.copyWith(
buttonVisibility: null == buttonVisibility
? _value.buttonVisibility
? _self.buttonVisibility
: buttonVisibility // ignore: cast_nullable_to_non_nullable
as bool,
animes: null == animes
? _value._animes
? _self.animes
: animes // ignore: cast_nullable_to_non_nullable
as List<AnimeTrackingData>,
mangas: null == mangas
? _value._mangas
? _self.mangas
: mangas // ignore: cast_nullable_to_non_nullable
as List<MangaTrackingData>,
animeFilterState: null == animeFilterState
? _value.animeFilterState
? _self.animeFilterState
: animeFilterState // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
mangaFilterState: null == mangaFilterState
? _value.mangaFilterState
? _self.mangaFilterState
: mangaFilterState // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
trackingType: null == trackingType
? _value.trackingType
? _self.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType,
));
}
}
/// Adds pattern-matching-related methods to [AnimeListState].
extension AnimeListStatePatterns on AnimeListState {
/// 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(_AnimeListState value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _AnimeListState() 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(_AnimeListState value) $default,
) {
final _that = this;
switch (_that) {
case _AnimeListState():
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(_AnimeListState value)? $default,
) {
final _that = this;
switch (_that) {
case _AnimeListState() 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(
bool buttonVisibility,
List<AnimeTrackingData> animes,
List<MangaTrackingData> mangas,
MediumTrackingState animeFilterState,
MediumTrackingState mangaFilterState,
TrackingMediumType trackingType)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _AnimeListState() when $default != null:
return $default(_that.buttonVisibility, _that.animes, _that.mangas,
_that.animeFilterState, _that.mangaFilterState, _that.trackingType);
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(
bool buttonVisibility,
List<AnimeTrackingData> animes,
List<MangaTrackingData> mangas,
MediumTrackingState animeFilterState,
MediumTrackingState mangaFilterState,
TrackingMediumType trackingType)
$default,
) {
final _that = this;
switch (_that) {
case _AnimeListState():
return $default(_that.buttonVisibility, _that.animes, _that.mangas,
_that.animeFilterState, _that.mangaFilterState, _that.trackingType);
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(
bool buttonVisibility,
List<AnimeTrackingData> animes,
List<MangaTrackingData> mangas,
MediumTrackingState animeFilterState,
MediumTrackingState mangaFilterState,
TrackingMediumType trackingType)?
$default,
) {
final _that = this;
switch (_that) {
case _AnimeListState() when $default != null:
return $default(_that.buttonVisibility, _that.animes, _that.mangas,
_that.animeFilterState, _that.mangaFilterState, _that.trackingType);
case _:
return null;
}
}
}
/// @nodoc
class _$AnimeListStateImpl implements _AnimeListState {
_$AnimeListStateImpl(
class _AnimeListState implements AnimeListState {
_AnimeListState(
{this.buttonVisibility = true,
final List<AnimeTrackingData> animes = const [],
final List<MangaTrackingData> mangas = const [],
@@ -208,16 +351,19 @@ class _$AnimeListStateImpl implements _AnimeListState {
@JsonKey()
final TrackingMediumType trackingType;
/// Create a copy of AnimeListState
/// with the given fields replaced by the non-null parameter values.
@override
String toString() {
return 'AnimeListState(buttonVisibility: $buttonVisibility, animes: $animes, mangas: $mangas, animeFilterState: $animeFilterState, mangaFilterState: $mangaFilterState, trackingType: $trackingType)';
}
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AnimeListStateCopyWith<_AnimeListState> get copyWith =>
__$AnimeListStateCopyWithImpl<_AnimeListState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$AnimeListStateImpl &&
other is _AnimeListState &&
(identical(other.buttonVisibility, buttonVisibility) ||
other.buttonVisibility == buttonVisibility) &&
const DeepCollectionEquality().equals(other._animes, _animes) &&
@@ -240,42 +386,76 @@ class _$AnimeListStateImpl implements _AnimeListState {
mangaFilterState,
trackingType);
@override
String toString() {
return 'AnimeListState(buttonVisibility: $buttonVisibility, animes: $animes, mangas: $mangas, animeFilterState: $animeFilterState, mangaFilterState: $mangaFilterState, trackingType: $trackingType)';
}
}
/// @nodoc
abstract mixin class _$AnimeListStateCopyWith<$Res>
implements $AnimeListStateCopyWith<$Res> {
factory _$AnimeListStateCopyWith(
_AnimeListState value, $Res Function(_AnimeListState) _then) =
__$AnimeListStateCopyWithImpl;
@override
@useResult
$Res call(
{bool buttonVisibility,
List<AnimeTrackingData> animes,
List<MangaTrackingData> mangas,
MediumTrackingState animeFilterState,
MediumTrackingState mangaFilterState,
TrackingMediumType trackingType});
}
/// @nodoc
class __$AnimeListStateCopyWithImpl<$Res>
implements _$AnimeListStateCopyWith<$Res> {
__$AnimeListStateCopyWithImpl(this._self, this._then);
final _AnimeListState _self;
final $Res Function(_AnimeListState) _then;
/// Create a copy of AnimeListState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$AnimeListStateImplCopyWith<_$AnimeListStateImpl> get copyWith =>
__$$AnimeListStateImplCopyWithImpl<_$AnimeListStateImpl>(
this, _$identity);
$Res call({
Object? buttonVisibility = null,
Object? animes = null,
Object? mangas = null,
Object? animeFilterState = null,
Object? mangaFilterState = null,
Object? trackingType = null,
}) {
return _then(_AnimeListState(
buttonVisibility: null == buttonVisibility
? _self.buttonVisibility
: buttonVisibility // ignore: cast_nullable_to_non_nullable
as bool,
animes: null == animes
? _self._animes
: animes // ignore: cast_nullable_to_non_nullable
as List<AnimeTrackingData>,
mangas: null == mangas
? _self._mangas
: mangas // ignore: cast_nullable_to_non_nullable
as List<MangaTrackingData>,
animeFilterState: null == animeFilterState
? _self.animeFilterState
: animeFilterState // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
mangaFilterState: null == mangaFilterState
? _self.mangaFilterState
: mangaFilterState // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
trackingType: null == trackingType
? _self.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType,
));
}
}
abstract class _AnimeListState implements AnimeListState {
factory _AnimeListState(
{final bool buttonVisibility,
final List<AnimeTrackingData> animes,
final List<MangaTrackingData> mangas,
final MediumTrackingState animeFilterState,
final MediumTrackingState mangaFilterState,
final TrackingMediumType trackingType}) = _$AnimeListStateImpl;
@override
bool get buttonVisibility;
@override
List<AnimeTrackingData> get animes;
@override
List<MangaTrackingData> get mangas;
@override
MediumTrackingState get animeFilterState;
@override
MediumTrackingState get mangaFilterState;
@override
TrackingMediumType get trackingType;
/// Create a copy of AnimeListState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$AnimeListStateImplCopyWith<_$AnimeListStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
// dart format on

View File

@@ -1,7 +1,7 @@
part of 'anime_list_bloc.dart';
@freezed
class AnimeListState with _$AnimeListState {
abstract class AnimeListState with _$AnimeListState {
factory AnimeListState({
@Default(true) bool buttonVisibility,
@Default([]) List<AnimeTrackingData> animes,

View File

@@ -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,86 +9,53 @@ part of 'anime_search_bloc.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 _$AnimeSearchState {
TrackingMediumType get trackingType => throw _privateConstructorUsedError;
String get searchQuery => throw _privateConstructorUsedError;
bool get working => throw _privateConstructorUsedError;
List<SearchResult> get searchResults => throw _privateConstructorUsedError;
TrackingMediumType get trackingType;
String get searchQuery;
bool get working;
List<SearchResult> get searchResults;
/// Create a copy of AnimeSearchState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$AnimeSearchStateCopyWith<AnimeSearchState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $AnimeSearchStateCopyWith<$Res> {
factory $AnimeSearchStateCopyWith(
AnimeSearchState value, $Res Function(AnimeSearchState) then) =
_$AnimeSearchStateCopyWithImpl<$Res, AnimeSearchState>;
@useResult
$Res call(
{TrackingMediumType trackingType,
String searchQuery,
bool working,
List<SearchResult> searchResults});
}
/// @nodoc
class _$AnimeSearchStateCopyWithImpl<$Res, $Val extends AnimeSearchState>
implements $AnimeSearchStateCopyWith<$Res> {
_$AnimeSearchStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of AnimeSearchState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
$AnimeSearchStateCopyWith<AnimeSearchState> get copyWith =>
_$AnimeSearchStateCopyWithImpl<AnimeSearchState>(
this as AnimeSearchState, _$identity);
@override
$Res call({
Object? trackingType = null,
Object? searchQuery = null,
Object? working = null,
Object? searchResults = null,
}) {
return _then(_value.copyWith(
trackingType: null == trackingType
? _value.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType,
searchQuery: null == searchQuery
? _value.searchQuery
: searchQuery // ignore: cast_nullable_to_non_nullable
as String,
working: null == working
? _value.working
: working // ignore: cast_nullable_to_non_nullable
as bool,
searchResults: null == searchResults
? _value.searchResults
: searchResults // ignore: cast_nullable_to_non_nullable
as List<SearchResult>,
) as $Val);
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is AnimeSearchState &&
(identical(other.trackingType, trackingType) ||
other.trackingType == trackingType) &&
(identical(other.searchQuery, searchQuery) ||
other.searchQuery == searchQuery) &&
(identical(other.working, working) || other.working == working) &&
const DeepCollectionEquality()
.equals(other.searchResults, searchResults));
}
@override
int get hashCode => Object.hash(runtimeType, trackingType, searchQuery,
working, const DeepCollectionEquality().hash(searchResults));
@override
String toString() {
return 'AnimeSearchState(trackingType: $trackingType, searchQuery: $searchQuery, working: $working, searchResults: $searchResults)';
}
}
/// @nodoc
abstract class _$$AnimeSearchStateImplCopyWith<$Res>
implements $AnimeSearchStateCopyWith<$Res> {
factory _$$AnimeSearchStateImplCopyWith(_$AnimeSearchStateImpl value,
$Res Function(_$AnimeSearchStateImpl) then) =
__$$AnimeSearchStateImplCopyWithImpl<$Res>;
@override
abstract mixin class $AnimeSearchStateCopyWith<$Res> {
factory $AnimeSearchStateCopyWith(
AnimeSearchState value, $Res Function(AnimeSearchState) _then) =
_$AnimeSearchStateCopyWithImpl;
@useResult
$Res call(
{TrackingMediumType trackingType,
@@ -98,12 +65,12 @@ abstract class _$$AnimeSearchStateImplCopyWith<$Res>
}
/// @nodoc
class __$$AnimeSearchStateImplCopyWithImpl<$Res>
extends _$AnimeSearchStateCopyWithImpl<$Res, _$AnimeSearchStateImpl>
implements _$$AnimeSearchStateImplCopyWith<$Res> {
__$$AnimeSearchStateImplCopyWithImpl(_$AnimeSearchStateImpl _value,
$Res Function(_$AnimeSearchStateImpl) _then)
: super(_value, _then);
class _$AnimeSearchStateCopyWithImpl<$Res>
implements $AnimeSearchStateCopyWith<$Res> {
_$AnimeSearchStateCopyWithImpl(this._self, this._then);
final AnimeSearchState _self;
final $Res Function(AnimeSearchState) _then;
/// Create a copy of AnimeSearchState
/// with the given fields replaced by the non-null parameter values.
@@ -115,31 +82,197 @@ class __$$AnimeSearchStateImplCopyWithImpl<$Res>
Object? working = null,
Object? searchResults = null,
}) {
return _then(_$AnimeSearchStateImpl(
return _then(_self.copyWith(
trackingType: null == trackingType
? _value.trackingType
? _self.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType,
searchQuery: null == searchQuery
? _value.searchQuery
? _self.searchQuery
: searchQuery // ignore: cast_nullable_to_non_nullable
as String,
working: null == working
? _value.working
? _self.working
: working // ignore: cast_nullable_to_non_nullable
as bool,
searchResults: null == searchResults
? _value._searchResults
? _self.searchResults
: searchResults // ignore: cast_nullable_to_non_nullable
as List<SearchResult>,
));
}
}
/// Adds pattern-matching-related methods to [AnimeSearchState].
extension AnimeSearchStatePatterns on AnimeSearchState {
/// 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(_AnimeSearchState value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _AnimeSearchState() 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(_AnimeSearchState value) $default,
) {
final _that = this;
switch (_that) {
case _AnimeSearchState():
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(_AnimeSearchState value)? $default,
) {
final _that = this;
switch (_that) {
case _AnimeSearchState() 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(TrackingMediumType trackingType, String searchQuery,
bool working, List<SearchResult> searchResults)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _AnimeSearchState() when $default != null:
return $default(_that.trackingType, _that.searchQuery, _that.working,
_that.searchResults);
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(TrackingMediumType trackingType, String searchQuery,
bool working, List<SearchResult> searchResults)
$default,
) {
final _that = this;
switch (_that) {
case _AnimeSearchState():
return $default(_that.trackingType, _that.searchQuery, _that.working,
_that.searchResults);
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(TrackingMediumType trackingType, String searchQuery,
bool working, List<SearchResult> searchResults)?
$default,
) {
final _that = this;
switch (_that) {
case _AnimeSearchState() when $default != null:
return $default(_that.trackingType, _that.searchQuery, _that.working,
_that.searchResults);
case _:
return null;
}
}
}
/// @nodoc
class _$AnimeSearchStateImpl implements _AnimeSearchState {
_$AnimeSearchStateImpl(
class _AnimeSearchState implements AnimeSearchState {
_AnimeSearchState(
{this.trackingType = TrackingMediumType.anime,
this.searchQuery = '',
this.working = false,
@@ -164,16 +297,19 @@ class _$AnimeSearchStateImpl implements _AnimeSearchState {
return EqualUnmodifiableListView(_searchResults);
}
/// Create a copy of AnimeSearchState
/// with the given fields replaced by the non-null parameter values.
@override
String toString() {
return 'AnimeSearchState(trackingType: $trackingType, searchQuery: $searchQuery, working: $working, searchResults: $searchResults)';
}
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AnimeSearchStateCopyWith<_AnimeSearchState> get copyWith =>
__$AnimeSearchStateCopyWithImpl<_AnimeSearchState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$AnimeSearchStateImpl &&
other is _AnimeSearchState &&
(identical(other.trackingType, trackingType) ||
other.trackingType == trackingType) &&
(identical(other.searchQuery, searchQuery) ||
@@ -187,36 +323,64 @@ class _$AnimeSearchStateImpl implements _AnimeSearchState {
int get hashCode => Object.hash(runtimeType, trackingType, searchQuery,
working, const DeepCollectionEquality().hash(_searchResults));
@override
String toString() {
return 'AnimeSearchState(trackingType: $trackingType, searchQuery: $searchQuery, working: $working, searchResults: $searchResults)';
}
}
/// @nodoc
abstract mixin class _$AnimeSearchStateCopyWith<$Res>
implements $AnimeSearchStateCopyWith<$Res> {
factory _$AnimeSearchStateCopyWith(
_AnimeSearchState value, $Res Function(_AnimeSearchState) _then) =
__$AnimeSearchStateCopyWithImpl;
@override
@useResult
$Res call(
{TrackingMediumType trackingType,
String searchQuery,
bool working,
List<SearchResult> searchResults});
}
/// @nodoc
class __$AnimeSearchStateCopyWithImpl<$Res>
implements _$AnimeSearchStateCopyWith<$Res> {
__$AnimeSearchStateCopyWithImpl(this._self, this._then);
final _AnimeSearchState _self;
final $Res Function(_AnimeSearchState) _then;
/// Create a copy of AnimeSearchState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$AnimeSearchStateImplCopyWith<_$AnimeSearchStateImpl> get copyWith =>
__$$AnimeSearchStateImplCopyWithImpl<_$AnimeSearchStateImpl>(
this, _$identity);
$Res call({
Object? trackingType = null,
Object? searchQuery = null,
Object? working = null,
Object? searchResults = null,
}) {
return _then(_AnimeSearchState(
trackingType: null == trackingType
? _self.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType,
searchQuery: null == searchQuery
? _self.searchQuery
: searchQuery // ignore: cast_nullable_to_non_nullable
as String,
working: null == working
? _self.working
: working // ignore: cast_nullable_to_non_nullable
as bool,
searchResults: null == searchResults
? _self._searchResults
: searchResults // ignore: cast_nullable_to_non_nullable
as List<SearchResult>,
));
}
}
abstract class _AnimeSearchState implements AnimeSearchState {
factory _AnimeSearchState(
{final TrackingMediumType trackingType,
final String searchQuery,
final bool working,
final List<SearchResult> searchResults}) = _$AnimeSearchStateImpl;
@override
TrackingMediumType get trackingType;
@override
String get searchQuery;
@override
bool get working;
@override
List<SearchResult> get searchResults;
/// Create a copy of AnimeSearchState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$AnimeSearchStateImplCopyWith<_$AnimeSearchStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
// dart format on

View File

@@ -1,7 +1,7 @@
part of 'anime_search_bloc.dart';
@freezed
class AnimeSearchState with _$AnimeSearchState {
abstract class AnimeSearchState with _$AnimeSearchState {
factory AnimeSearchState({
@Default(TrackingMediumType.anime) TrackingMediumType trackingType,
@Default('') String searchQuery,

View File

@@ -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,137 +9,28 @@ part of 'calendar_bloc.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 _$CalendarState {
bool get refreshing => throw _privateConstructorUsedError;
int get refreshingCount => throw _privateConstructorUsedError;
int get refreshingTotal => throw _privateConstructorUsedError;
bool get refreshing;
int get refreshingCount;
int get refreshingTotal;
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$CalendarStateCopyWith<CalendarState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $CalendarStateCopyWith<$Res> {
factory $CalendarStateCopyWith(
CalendarState value, $Res Function(CalendarState) then) =
_$CalendarStateCopyWithImpl<$Res, CalendarState>;
@useResult
$Res call({bool refreshing, int refreshingCount, int refreshingTotal});
}
/// @nodoc
class _$CalendarStateCopyWithImpl<$Res, $Val extends CalendarState>
implements $CalendarStateCopyWith<$Res> {
_$CalendarStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? refreshing = null,
Object? refreshingCount = null,
Object? refreshingTotal = null,
}) {
return _then(_value.copyWith(
refreshing: null == refreshing
? _value.refreshing
: refreshing // ignore: cast_nullable_to_non_nullable
as bool,
refreshingCount: null == refreshingCount
? _value.refreshingCount
: refreshingCount // ignore: cast_nullable_to_non_nullable
as int,
refreshingTotal: null == refreshingTotal
? _value.refreshingTotal
: refreshingTotal // ignore: cast_nullable_to_non_nullable
as int,
) as $Val);
}
}
/// @nodoc
abstract class _$$CalendarStateImplCopyWith<$Res>
implements $CalendarStateCopyWith<$Res> {
factory _$$CalendarStateImplCopyWith(
_$CalendarStateImpl value, $Res Function(_$CalendarStateImpl) then) =
__$$CalendarStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({bool refreshing, int refreshingCount, int refreshingTotal});
}
/// @nodoc
class __$$CalendarStateImplCopyWithImpl<$Res>
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateImpl>
implements _$$CalendarStateImplCopyWith<$Res> {
__$$CalendarStateImplCopyWithImpl(
_$CalendarStateImpl _value, $Res Function(_$CalendarStateImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? refreshing = null,
Object? refreshingCount = null,
Object? refreshingTotal = null,
}) {
return _then(_$CalendarStateImpl(
null == refreshing
? _value.refreshing
: refreshing // ignore: cast_nullable_to_non_nullable
as bool,
null == refreshingCount
? _value.refreshingCount
: refreshingCount // ignore: cast_nullable_to_non_nullable
as int,
null == refreshingTotal
? _value.refreshingTotal
: refreshingTotal // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// @nodoc
class _$CalendarStateImpl implements _CalendarState {
_$CalendarStateImpl(
this.refreshing, this.refreshingCount, this.refreshingTotal);
@override
final bool refreshing;
@override
final int refreshingCount;
@override
final int refreshingTotal;
@override
String toString() {
return 'CalendarState(refreshing: $refreshing, refreshingCount: $refreshingCount, refreshingTotal: $refreshingTotal)';
}
_$CalendarStateCopyWithImpl<CalendarState>(
this as CalendarState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CalendarStateImpl &&
other is CalendarState &&
(identical(other.refreshing, refreshing) ||
other.refreshing == refreshing) &&
(identical(other.refreshingCount, refreshingCount) ||
@@ -152,30 +43,305 @@ class _$CalendarStateImpl implements _CalendarState {
int get hashCode =>
Object.hash(runtimeType, refreshing, refreshingCount, refreshingTotal);
@override
String toString() {
return 'CalendarState(refreshing: $refreshing, refreshingCount: $refreshingCount, refreshingTotal: $refreshingTotal)';
}
}
/// @nodoc
abstract mixin class $CalendarStateCopyWith<$Res> {
factory $CalendarStateCopyWith(
CalendarState value, $Res Function(CalendarState) _then) =
_$CalendarStateCopyWithImpl;
@useResult
$Res call({bool refreshing, int refreshingCount, int refreshingTotal});
}
/// @nodoc
class _$CalendarStateCopyWithImpl<$Res>
implements $CalendarStateCopyWith<$Res> {
_$CalendarStateCopyWithImpl(this._self, this._then);
final CalendarState _self;
final $Res Function(CalendarState) _then;
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? refreshing = null,
Object? refreshingCount = null,
Object? refreshingTotal = null,
}) {
return _then(_self.copyWith(
refreshing: null == refreshing
? _self.refreshing
: refreshing // ignore: cast_nullable_to_non_nullable
as bool,
refreshingCount: null == refreshingCount
? _self.refreshingCount
: refreshingCount // ignore: cast_nullable_to_non_nullable
as int,
refreshingTotal: null == refreshingTotal
? _self.refreshingTotal
: refreshingTotal // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// Adds pattern-matching-related methods to [CalendarState].
extension CalendarStatePatterns on CalendarState {
/// 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(_CalendarState value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _CalendarState() 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(_CalendarState value) $default,
) {
final _that = this;
switch (_that) {
case _CalendarState():
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(_CalendarState value)? $default,
) {
final _that = this;
switch (_that) {
case _CalendarState() 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(bool refreshing, int refreshingCount, int refreshingTotal)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _CalendarState() when $default != null:
return $default(
_that.refreshing, _that.refreshingCount, _that.refreshingTotal);
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(bool refreshing, int refreshingCount, int refreshingTotal)
$default,
) {
final _that = this;
switch (_that) {
case _CalendarState():
return $default(
_that.refreshing, _that.refreshingCount, _that.refreshingTotal);
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(
bool refreshing, int refreshingCount, int refreshingTotal)?
$default,
) {
final _that = this;
switch (_that) {
case _CalendarState() when $default != null:
return $default(
_that.refreshing, _that.refreshingCount, _that.refreshingTotal);
case _:
return null;
}
}
}
/// @nodoc
class _CalendarState implements CalendarState {
_CalendarState(this.refreshing, this.refreshingCount, this.refreshingTotal);
@override
final bool refreshing;
@override
final int refreshingCount;
@override
final int refreshingTotal;
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$CalendarStateCopyWith<_CalendarState> get copyWith =>
__$CalendarStateCopyWithImpl<_CalendarState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _CalendarState &&
(identical(other.refreshing, refreshing) ||
other.refreshing == refreshing) &&
(identical(other.refreshingCount, refreshingCount) ||
other.refreshingCount == refreshingCount) &&
(identical(other.refreshingTotal, refreshingTotal) ||
other.refreshingTotal == refreshingTotal));
}
@override
int get hashCode =>
Object.hash(runtimeType, refreshing, refreshingCount, refreshingTotal);
@override
String toString() {
return 'CalendarState(refreshing: $refreshing, refreshingCount: $refreshingCount, refreshingTotal: $refreshingTotal)';
}
}
/// @nodoc
abstract mixin class _$CalendarStateCopyWith<$Res>
implements $CalendarStateCopyWith<$Res> {
factory _$CalendarStateCopyWith(
_CalendarState value, $Res Function(_CalendarState) _then) =
__$CalendarStateCopyWithImpl;
@override
@useResult
$Res call({bool refreshing, int refreshingCount, int refreshingTotal});
}
/// @nodoc
class __$CalendarStateCopyWithImpl<$Res>
implements _$CalendarStateCopyWith<$Res> {
__$CalendarStateCopyWithImpl(this._self, this._then);
final _CalendarState _self;
final $Res Function(_CalendarState) _then;
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
_$$CalendarStateImplCopyWith<_$CalendarStateImpl> get copyWith =>
__$$CalendarStateImplCopyWithImpl<_$CalendarStateImpl>(this, _$identity);
$Res call({
Object? refreshing = null,
Object? refreshingCount = null,
Object? refreshingTotal = null,
}) {
return _then(_CalendarState(
null == refreshing
? _self.refreshing
: refreshing // ignore: cast_nullable_to_non_nullable
as bool,
null == refreshingCount
? _self.refreshingCount
: refreshingCount // ignore: cast_nullable_to_non_nullable
as int,
null == refreshingTotal
? _self.refreshingTotal
: refreshingTotal // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
abstract class _CalendarState implements CalendarState {
factory _CalendarState(final bool refreshing, final int refreshingCount,
final int refreshingTotal) = _$CalendarStateImpl;
@override
bool get refreshing;
@override
int get refreshingCount;
@override
int get refreshingTotal;
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CalendarStateImplCopyWith<_$CalendarStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
// dart format on

View File

@@ -1,7 +1,7 @@
part of 'calendar_bloc.dart';
@freezed
class CalendarState with _$CalendarState {
abstract class CalendarState with _$CalendarState {
factory CalendarState(
bool refreshing,
int refreshingCount,

View File

@@ -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,79 +9,50 @@ part of 'details_bloc.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 _$DetailsState {
TrackingMedium? get data => throw _privateConstructorUsedError;
String? get heroImagePrefix => throw _privateConstructorUsedError;
TrackingMediumType get trackingType => throw _privateConstructorUsedError;
TrackingMedium? get data;
String? get heroImagePrefix;
TrackingMediumType get trackingType;
/// Create a copy of DetailsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$DetailsStateCopyWith<DetailsState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $DetailsStateCopyWith<$Res> {
factory $DetailsStateCopyWith(
DetailsState value, $Res Function(DetailsState) then) =
_$DetailsStateCopyWithImpl<$Res, DetailsState>;
@useResult
$Res call(
{TrackingMedium? data,
String? heroImagePrefix,
TrackingMediumType trackingType});
}
/// @nodoc
class _$DetailsStateCopyWithImpl<$Res, $Val extends DetailsState>
implements $DetailsStateCopyWith<$Res> {
_$DetailsStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DetailsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
$DetailsStateCopyWith<DetailsState> get copyWith =>
_$DetailsStateCopyWithImpl<DetailsState>(
this as DetailsState, _$identity);
@override
$Res call({
Object? data = freezed,
Object? heroImagePrefix = freezed,
Object? trackingType = null,
}) {
return _then(_value.copyWith(
data: freezed == data
? _value.data
: data // ignore: cast_nullable_to_non_nullable
as TrackingMedium?,
heroImagePrefix: freezed == heroImagePrefix
? _value.heroImagePrefix
: heroImagePrefix // ignore: cast_nullable_to_non_nullable
as String?,
trackingType: null == trackingType
? _value.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType,
) as $Val);
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is DetailsState &&
(identical(other.data, data) || other.data == data) &&
(identical(other.heroImagePrefix, heroImagePrefix) ||
other.heroImagePrefix == heroImagePrefix) &&
(identical(other.trackingType, trackingType) ||
other.trackingType == trackingType));
}
@override
int get hashCode =>
Object.hash(runtimeType, data, heroImagePrefix, trackingType);
@override
String toString() {
return 'DetailsState(data: $data, heroImagePrefix: $heroImagePrefix, trackingType: $trackingType)';
}
}
/// @nodoc
abstract class _$$DetailsStateImplCopyWith<$Res>
implements $DetailsStateCopyWith<$Res> {
factory _$$DetailsStateImplCopyWith(
_$DetailsStateImpl value, $Res Function(_$DetailsStateImpl) then) =
__$$DetailsStateImplCopyWithImpl<$Res>;
@override
abstract mixin class $DetailsStateCopyWith<$Res> {
factory $DetailsStateCopyWith(
DetailsState value, $Res Function(DetailsState) _then) =
_$DetailsStateCopyWithImpl;
@useResult
$Res call(
{TrackingMedium? data,
@@ -90,12 +61,11 @@ abstract class _$$DetailsStateImplCopyWith<$Res>
}
/// @nodoc
class __$$DetailsStateImplCopyWithImpl<$Res>
extends _$DetailsStateCopyWithImpl<$Res, _$DetailsStateImpl>
implements _$$DetailsStateImplCopyWith<$Res> {
__$$DetailsStateImplCopyWithImpl(
_$DetailsStateImpl _value, $Res Function(_$DetailsStateImpl) _then)
: super(_value, _then);
class _$DetailsStateCopyWithImpl<$Res> implements $DetailsStateCopyWith<$Res> {
_$DetailsStateCopyWithImpl(this._self, this._then);
final DetailsState _self;
final $Res Function(DetailsState) _then;
/// Create a copy of DetailsState
/// with the given fields replaced by the non-null parameter values.
@@ -106,27 +76,190 @@ class __$$DetailsStateImplCopyWithImpl<$Res>
Object? heroImagePrefix = freezed,
Object? trackingType = null,
}) {
return _then(_$DetailsStateImpl(
return _then(_self.copyWith(
data: freezed == data
? _value.data
? _self.data
: data // ignore: cast_nullable_to_non_nullable
as TrackingMedium?,
heroImagePrefix: freezed == heroImagePrefix
? _value.heroImagePrefix
? _self.heroImagePrefix
: heroImagePrefix // ignore: cast_nullable_to_non_nullable
as String?,
trackingType: null == trackingType
? _value.trackingType
? _self.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType,
));
}
}
/// Adds pattern-matching-related methods to [DetailsState].
extension DetailsStatePatterns on DetailsState {
/// 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(_DetailsState value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _DetailsState() 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(_DetailsState value) $default,
) {
final _that = this;
switch (_that) {
case _DetailsState():
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(_DetailsState value)? $default,
) {
final _that = this;
switch (_that) {
case _DetailsState() 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(TrackingMedium? data, String? heroImagePrefix,
TrackingMediumType trackingType)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _DetailsState() when $default != null:
return $default(_that.data, _that.heroImagePrefix, _that.trackingType);
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(TrackingMedium? data, String? heroImagePrefix,
TrackingMediumType trackingType)
$default,
) {
final _that = this;
switch (_that) {
case _DetailsState():
return $default(_that.data, _that.heroImagePrefix, _that.trackingType);
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(TrackingMedium? data, String? heroImagePrefix,
TrackingMediumType trackingType)?
$default,
) {
final _that = this;
switch (_that) {
case _DetailsState() when $default != null:
return $default(_that.data, _that.heroImagePrefix, _that.trackingType);
case _:
return null;
}
}
}
/// @nodoc
class _$DetailsStateImpl implements _DetailsState {
_$DetailsStateImpl(
class _DetailsState implements DetailsState {
_DetailsState(
{this.data,
this.heroImagePrefix,
this.trackingType = TrackingMediumType.anime});
@@ -139,16 +272,19 @@ class _$DetailsStateImpl implements _DetailsState {
@JsonKey()
final TrackingMediumType trackingType;
/// Create a copy of DetailsState
/// with the given fields replaced by the non-null parameter values.
@override
String toString() {
return 'DetailsState(data: $data, heroImagePrefix: $heroImagePrefix, trackingType: $trackingType)';
}
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$DetailsStateCopyWith<_DetailsState> get copyWith =>
__$DetailsStateCopyWithImpl<_DetailsState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DetailsStateImpl &&
other is _DetailsState &&
(identical(other.data, data) || other.data == data) &&
(identical(other.heroImagePrefix, heroImagePrefix) ||
other.heroImagePrefix == heroImagePrefix) &&
@@ -160,32 +296,58 @@ class _$DetailsStateImpl implements _DetailsState {
int get hashCode =>
Object.hash(runtimeType, data, heroImagePrefix, trackingType);
@override
String toString() {
return 'DetailsState(data: $data, heroImagePrefix: $heroImagePrefix, trackingType: $trackingType)';
}
}
/// @nodoc
abstract mixin class _$DetailsStateCopyWith<$Res>
implements $DetailsStateCopyWith<$Res> {
factory _$DetailsStateCopyWith(
_DetailsState value, $Res Function(_DetailsState) _then) =
__$DetailsStateCopyWithImpl;
@override
@useResult
$Res call(
{TrackingMedium? data,
String? heroImagePrefix,
TrackingMediumType trackingType});
}
/// @nodoc
class __$DetailsStateCopyWithImpl<$Res>
implements _$DetailsStateCopyWith<$Res> {
__$DetailsStateCopyWithImpl(this._self, this._then);
final _DetailsState _self;
final $Res Function(_DetailsState) _then;
/// Create a copy of DetailsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DetailsStateImplCopyWith<_$DetailsStateImpl> get copyWith =>
__$$DetailsStateImplCopyWithImpl<_$DetailsStateImpl>(this, _$identity);
$Res call({
Object? data = freezed,
Object? heroImagePrefix = freezed,
Object? trackingType = null,
}) {
return _then(_DetailsState(
data: freezed == data
? _self.data
: data // ignore: cast_nullable_to_non_nullable
as TrackingMedium?,
heroImagePrefix: freezed == heroImagePrefix
? _self.heroImagePrefix
: heroImagePrefix // ignore: cast_nullable_to_non_nullable
as String?,
trackingType: null == trackingType
? _self.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType,
));
}
}
abstract class _DetailsState implements DetailsState {
factory _DetailsState(
{final TrackingMedium? data,
final String? heroImagePrefix,
final TrackingMediumType trackingType}) = _$DetailsStateImpl;
@override
TrackingMedium? get data;
@override
String? get heroImagePrefix;
@override
TrackingMediumType get trackingType;
/// Create a copy of DetailsState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DetailsStateImplCopyWith<_$DetailsStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
// dart format on

View File

@@ -1,7 +1,7 @@
part of 'details_bloc.dart';
@freezed
class DetailsState with _$DetailsState {
abstract class DetailsState with _$DetailsState {
factory DetailsState({
TrackingMedium? data,
String? heroImagePrefix,

View File

@@ -75,8 +75,8 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
);
_showLoadingSpinner(emit);
final inputStream = InputFileStream(event.path);
final listRaw = GZipDecoder().decodeBuffer(inputStream);
final input = await File(event.path).readAsBytes();
final listRaw = const GZipDecoder().decodeBytes(input);
final listXml = utf8.decode(listRaw);
final document = XmlDocument.parse(listXml);
final mal = document.getElement('myanimelist');
@@ -148,8 +148,8 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
);
_showLoadingSpinner(emit);
final inputStream = InputFileStream(event.path);
final listRaw = GZipDecoder().decodeBuffer(inputStream);
final input = await File(event.path).readAsBytes();
final listRaw = const archive.GZipDecoder().decodeBytes(input);
final listXml = utf8.decode(listRaw);
final document = XmlDocument.parse(listXml);
final mal = document.getElement('myanimelist');
@@ -230,11 +230,9 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
event.path,
'anitrack_${date.year}${date.month}${date.day}.json.gz',
);
archive.GZipEncoder().encode(
InputStream(utf8.encode(exportData)),
output: OutputFileStream(outputPath),
);
final output = const archive.GZipEncoder().encode(utf8.encode(exportData));
await File(outputPath).writeAsBytes(output);
await Fluttertoast.showToast(
msg: t.settings.dataExportSuccess,
);

View File

@@ -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,87 +9,62 @@ part of 'settings_bloc.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 _$SettingsState {
bool get importSpinnerVisible => throw _privateConstructorUsedError;
int get importCurrent => throw _privateConstructorUsedError;
int get importTotal => throw _privateConstructorUsedError;
bool get importSpinnerVisible;
int get importCurrent;
int get importTotal;
/// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$SettingsStateCopyWith<SettingsState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $SettingsStateCopyWith<$Res> {
factory $SettingsStateCopyWith(
SettingsState value, $Res Function(SettingsState) then) =
_$SettingsStateCopyWithImpl<$Res, SettingsState>;
@useResult
$Res call({bool importSpinnerVisible, int importCurrent, int importTotal});
}
/// @nodoc
class _$SettingsStateCopyWithImpl<$Res, $Val extends SettingsState>
implements $SettingsStateCopyWith<$Res> {
_$SettingsStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
$SettingsStateCopyWith<SettingsState> get copyWith =>
_$SettingsStateCopyWithImpl<SettingsState>(
this as SettingsState, _$identity);
@override
$Res call({
Object? importSpinnerVisible = null,
Object? importCurrent = null,
Object? importTotal = null,
}) {
return _then(_value.copyWith(
importSpinnerVisible: null == importSpinnerVisible
? _value.importSpinnerVisible
: importSpinnerVisible // ignore: cast_nullable_to_non_nullable
as bool,
importCurrent: null == importCurrent
? _value.importCurrent
: importCurrent // ignore: cast_nullable_to_non_nullable
as int,
importTotal: null == importTotal
? _value.importTotal
: importTotal // ignore: cast_nullable_to_non_nullable
as int,
) as $Val);
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is SettingsState &&
(identical(other.importSpinnerVisible, importSpinnerVisible) ||
other.importSpinnerVisible == importSpinnerVisible) &&
(identical(other.importCurrent, importCurrent) ||
other.importCurrent == importCurrent) &&
(identical(other.importTotal, importTotal) ||
other.importTotal == importTotal));
}
@override
int get hashCode => Object.hash(
runtimeType, importSpinnerVisible, importCurrent, importTotal);
@override
String toString() {
return 'SettingsState(importSpinnerVisible: $importSpinnerVisible, importCurrent: $importCurrent, importTotal: $importTotal)';
}
}
/// @nodoc
abstract class _$$SettingsStateImplCopyWith<$Res>
implements $SettingsStateCopyWith<$Res> {
factory _$$SettingsStateImplCopyWith(
_$SettingsStateImpl value, $Res Function(_$SettingsStateImpl) then) =
__$$SettingsStateImplCopyWithImpl<$Res>;
@override
abstract mixin class $SettingsStateCopyWith<$Res> {
factory $SettingsStateCopyWith(
SettingsState value, $Res Function(SettingsState) _then) =
_$SettingsStateCopyWithImpl;
@useResult
$Res call({bool importSpinnerVisible, int importCurrent, int importTotal});
}
/// @nodoc
class __$$SettingsStateImplCopyWithImpl<$Res>
extends _$SettingsStateCopyWithImpl<$Res, _$SettingsStateImpl>
implements _$$SettingsStateImplCopyWith<$Res> {
__$$SettingsStateImplCopyWithImpl(
_$SettingsStateImpl _value, $Res Function(_$SettingsStateImpl) _then)
: super(_value, _then);
class _$SettingsStateCopyWithImpl<$Res>
implements $SettingsStateCopyWith<$Res> {
_$SettingsStateCopyWithImpl(this._self, this._then);
final SettingsState _self;
final $Res Function(SettingsState) _then;
/// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values.
@@ -100,27 +75,193 @@ class __$$SettingsStateImplCopyWithImpl<$Res>
Object? importCurrent = null,
Object? importTotal = null,
}) {
return _then(_$SettingsStateImpl(
return _then(_self.copyWith(
importSpinnerVisible: null == importSpinnerVisible
? _value.importSpinnerVisible
? _self.importSpinnerVisible
: importSpinnerVisible // ignore: cast_nullable_to_non_nullable
as bool,
importCurrent: null == importCurrent
? _value.importCurrent
? _self.importCurrent
: importCurrent // ignore: cast_nullable_to_non_nullable
as int,
importTotal: null == importTotal
? _value.importTotal
? _self.importTotal
: importTotal // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// Adds pattern-matching-related methods to [SettingsState].
extension SettingsStatePatterns on SettingsState {
/// 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(_SettingsState value)? $default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _SettingsState() 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(_SettingsState value) $default,
) {
final _that = this;
switch (_that) {
case _SettingsState():
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(_SettingsState value)? $default,
) {
final _that = this;
switch (_that) {
case _SettingsState() 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(
bool importSpinnerVisible, int importCurrent, int importTotal)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _SettingsState() when $default != null:
return $default(
_that.importSpinnerVisible, _that.importCurrent, _that.importTotal);
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(
bool importSpinnerVisible, int importCurrent, int importTotal)
$default,
) {
final _that = this;
switch (_that) {
case _SettingsState():
return $default(
_that.importSpinnerVisible, _that.importCurrent, _that.importTotal);
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(
bool importSpinnerVisible, int importCurrent, int importTotal)?
$default,
) {
final _that = this;
switch (_that) {
case _SettingsState() when $default != null:
return $default(
_that.importSpinnerVisible, _that.importCurrent, _that.importTotal);
case _:
return null;
}
}
}
/// @nodoc
class _$SettingsStateImpl implements _SettingsState {
_$SettingsStateImpl(
class _SettingsState implements SettingsState {
_SettingsState(
{this.importSpinnerVisible = false,
this.importCurrent = 0,
this.importTotal = 0});
@@ -135,16 +276,19 @@ class _$SettingsStateImpl implements _SettingsState {
@JsonKey()
final int importTotal;
/// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values.
@override
String toString() {
return 'SettingsState(importSpinnerVisible: $importSpinnerVisible, importCurrent: $importCurrent, importTotal: $importTotal)';
}
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SettingsStateCopyWith<_SettingsState> get copyWith =>
__$SettingsStateCopyWithImpl<_SettingsState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$SettingsStateImpl &&
other is _SettingsState &&
(identical(other.importSpinnerVisible, importSpinnerVisible) ||
other.importSpinnerVisible == importSpinnerVisible) &&
(identical(other.importCurrent, importCurrent) ||
@@ -157,32 +301,55 @@ class _$SettingsStateImpl implements _SettingsState {
int get hashCode => Object.hash(
runtimeType, importSpinnerVisible, importCurrent, importTotal);
@override
String toString() {
return 'SettingsState(importSpinnerVisible: $importSpinnerVisible, importCurrent: $importCurrent, importTotal: $importTotal)';
}
}
/// @nodoc
abstract mixin class _$SettingsStateCopyWith<$Res>
implements $SettingsStateCopyWith<$Res> {
factory _$SettingsStateCopyWith(
_SettingsState value, $Res Function(_SettingsState) _then) =
__$SettingsStateCopyWithImpl;
@override
@useResult
$Res call({bool importSpinnerVisible, int importCurrent, int importTotal});
}
/// @nodoc
class __$SettingsStateCopyWithImpl<$Res>
implements _$SettingsStateCopyWith<$Res> {
__$SettingsStateCopyWithImpl(this._self, this._then);
final _SettingsState _self;
final $Res Function(_SettingsState) _then;
/// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$SettingsStateImplCopyWith<_$SettingsStateImpl> get copyWith =>
__$$SettingsStateImplCopyWithImpl<_$SettingsStateImpl>(this, _$identity);
$Res call({
Object? importSpinnerVisible = null,
Object? importCurrent = null,
Object? importTotal = null,
}) {
return _then(_SettingsState(
importSpinnerVisible: null == importSpinnerVisible
? _self.importSpinnerVisible
: importSpinnerVisible // ignore: cast_nullable_to_non_nullable
as bool,
importCurrent: null == importCurrent
? _self.importCurrent
: importCurrent // ignore: cast_nullable_to_non_nullable
as int,
importTotal: null == importTotal
? _self.importTotal
: importTotal // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
abstract class _SettingsState implements SettingsState {
factory _SettingsState(
{final bool importSpinnerVisible,
final int importCurrent,
final int importTotal}) = _$SettingsStateImpl;
@override
bool get importSpinnerVisible;
@override
int get importCurrent;
@override
int get importTotal;
/// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$SettingsStateImplCopyWith<_$SettingsStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
// dart format on

View File

@@ -1,7 +1,7 @@
part of 'settings_bloc.dart';
@freezed
class SettingsState with _$SettingsState {
abstract class SettingsState with _$SettingsState {
factory SettingsState({
@Default(false) bool importSpinnerVisible,
@Default(0) int importCurrent,