diff --git a/chat/mnemo_cards_chat/pubspec.yaml b/chat/mnemo_cards_chat/pubspec.yaml index 9e9ba56..39835c4 100644 --- a/chat/mnemo_cards_chat/pubspec.yaml +++ b/chat/mnemo_cards_chat/pubspec.yaml @@ -18,8 +18,8 @@ dependencies: dio: ^5.3.3 # Immutable data models - freezed_annotation: ^2.4.1 - json_annotation: ^4.7.0 + freezed_annotation: ^3.0.1 + json_annotation: ^4.9.0 # Common utilities meta: ^1.8.0 @@ -30,7 +30,7 @@ dev_dependencies: # Code generation build_runner: ^2.4.13 - freezed: ^2.4.5 + freezed: ^3.0.6 json_serializable: ^6.8.0 # Linting diff --git a/mnemo_cards_backend/lib/api/di/injector.config.dart b/mnemo_cards_backend/lib/api/di/injector.config.dart index 0b970a1..82fb9b0 100644 --- a/mnemo_cards_backend/lib/api/di/injector.config.dart +++ b/mnemo_cards_backend/lib/api/di/injector.config.dart @@ -38,6 +38,7 @@ import '../user/google_api.dart' as _i972; import '../v2/admin_analytics_api_v2.dart' as _i368; import '../v2/admin_auth_api_v2.dart' as _i483; import '../v2/admin_cards_api_v2.dart' as _i922; +import '../v2/admin_packs_api_v2.dart' as _i1015; import '../v2/auth_api_v2.dart' as _i52; import '../v2/discounts_api_v2.dart' as _i858; import '../v2/jwt_service.dart' as _i108; @@ -104,6 +105,9 @@ extension GetItInjectableX on _i174.GetIt { gh.factory<_i922.AdminCardsApiV2>( () => _i922.AdminCardsApiV2(gh<_i1072.AppDatabase>()), ); + gh.factory<_i1015.AdminPacksApiV2>( + () => _i1015.AdminPacksApiV2(gh<_i1072.AppDatabase>()), + ); gh.lazySingleton<_i964.SubscriptionsApiV2>( () => _i964.SubscriptionsApiV2(gh<_i377.SubscriptionManager>()), ); diff --git a/mnemo_cards_backend/lib/api/mnemo_shelf.dart b/mnemo_cards_backend/lib/api/mnemo_shelf.dart index c49adc8..7e7c1a6 100644 --- a/mnemo_cards_backend/lib/api/mnemo_shelf.dart +++ b/mnemo_cards_backend/lib/api/mnemo_shelf.dart @@ -9,8 +9,8 @@ import 'package:shelf_router/shelf_router.dart'; // import 'v2/ads_api_v2.dart'; // disabled import 'v2/admin_analytics_api_v2.dart'; import 'v2/admin_auth_api_v2.dart'; -// import 'v2/admin_cards_api_v2.dart'; // disabled -// import 'v2/admin_packs_api_v2.dart'; // disabled +import 'v2/admin_cards_api_v2.dart'; +import 'v2/admin_packs_api_v2.dart'; // import 'v2/admin_users_api_v2.dart'; // disabled import 'v2/auth_api_v2.dart'; import 'v2/discounts_api_v2.dart'; @@ -54,6 +54,8 @@ class MnemoShelf { v2Router.mount('/', getIt.get().router); v2Router.mount('/', getIt.get().router); v2Router.mount('/', getIt.get().router); + v2Router.mount('/', getIt.get().router); + v2Router.mount('/', getIt.get().router); // v2Router.mount('/', getIt.get().router); // disabled v2Router.mount('/', getIt.get().router); // v2Router.mount('/', getIt.get().router); // disabled diff --git a/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.dart b/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.dart index 5d7d027..337c911 100644 --- a/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.dart +++ b/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.dart @@ -5,6 +5,9 @@ import 'package:drift_postgres/drift_postgres.dart'; import 'package:shelf/shelf.dart'; import 'package:shelf_router/shelf_router.dart'; import 'package:mnemo_cards_backend/database/database.dart'; +import 'package:mnemo_cards_backend/api/authorize/acl_types.dart'; +import 'package:mnemo_cards_backend/api/authorize/access_service.dart'; +import 'package:mnemo_cards_backend/api/authorize/helpers.dart'; import 'package:injectable/injectable.dart'; import 'package:drift/drift.dart' as drift; @@ -16,39 +19,94 @@ class AdminCardsApiV2 { const AdminCardsApiV2(this._db); - @Route.get('/cards') + Future _ensureAdmin(Request request) async { + try { + await request.access! + .requireAdmin(AdminAction.access, user: request.user); + return Response.ok(null); + } on AccessDenied catch (e) { + return Response(e.status, body: e.message); + } + } + + /// GET /api/v2/admin/cards + /// Get all cards with pagination and search + @Route.get('/admin/cards') Future getAllCards(Request request) async { try { - final packId = request.url.queryParameters['packId']; - final limit = int.tryParse(request.url.queryParameters['limit'] ?? '50') ?? 50; - final offset = int.tryParse(request.url.queryParameters['offset'] ?? '0') ?? 0; + final auth = await _ensureAdmin(request); + if (auth.statusCode != 200) { + return auth; + } - final cards = packId != null - ? await _db.packDao.getPackCards(packId) - : await _db.packDao.getAllCards(limit: limit, offset: offset); + final queryParams = request.url.queryParameters; + + // Parse pagination parameters + final page = int.tryParse(queryParams['page'] ?? '1') ?? 1; + final limit = int.tryParse(queryParams['limit'] ?? '20') ?? 20; + final search = queryParams['search'] ?? ''; - final total = packId != null - ? cards.length - : await _db.packDao.countCards(); + // Validate pagination + if (page < 1) { + return Response.badRequest( + body: json.encode({'error': 'Page must be greater than 0'}), + headers: {'Content-Type': 'application/json'}, + ); + } + if (limit < 1 || limit > 100) { + return Response.badRequest( + body: json.encode({'error': 'Limit must be between 1 and 100'}), + headers: {'Content-Type': 'application/json'}, + ); + } + + // Get all cards + final allCards = await _db.packDao.getAllCards(); + + // Apply search filter if provided + List filteredCards = allCards; + if (search.isNotEmpty) { + final searchTerm = search.toLowerCase(); + filteredCards = allCards.where((card) { + return card.original.toLowerCase().contains(searchTerm) || + card.translation.toLowerCase().contains(searchTerm) || + (card.mnemo?.toLowerCase().contains(searchTerm) ?? false) || + (card.transcription?.toLowerCase().contains(searchTerm) ?? false); + }).toList(); + } + + // Calculate pagination + final total = filteredCards.length; + final totalPages = (total / limit).ceil(); + final offset = (page - 1) * limit; + final paginatedCards = filteredCards.skip(offset).take(limit).toList(); return Response.ok( json.encode({ - 'cards': cards.map((card) => { - 'id': card.id, - 'packId': card.packId, - 'original': card.original, - 'translation': card.translation, - 'mnemo': card.mnemo, - 'image': card.image, - 'back': card.back, - 'transcription': card.transcription, - 'createdAt': card.createdAt.dateTime.toIso8601String(), + 'items': paginatedCards.map((card) { + // Try to parse ID as int, fallback to 0 if it's not a number + final cardId = int.tryParse(card.id) ?? 0; + return { + 'id': cardId, + 'packId': card.packId, + 'original': card.original, + 'translation': card.translation, + 'mnemo': card.mnemo, + 'image': card.image, + 'back': card.back, + 'transcription': card.transcription, + 'imageBack': card.imageBack, + }; }).toList(), - 'total': total, + 'total': total, + 'page': page, + 'limit': limit, + 'totalPages': totalPages, }), headers: {'Content-Type': 'application/json'}, ); - } catch (e) { + } catch (e, s) { + print('Error in getAllCards: $e\n$s'); return Response.internalServerError( body: json.encode({'error': e.toString()}), headers: {'Content-Type': 'application/json'}, @@ -56,7 +114,9 @@ class AdminCardsApiV2 { } } - @Route.get('/cards/') + /// GET /api/v2/admin/cards/{cardId} + /// Get a specific card by ID + @Route.get('/admin/cards/') Future getCard(Request request, String cardId) async { try { if (cardId.isEmpty) { @@ -85,7 +145,7 @@ class AdminCardsApiV2 { 'back': card.back, 'transcription': card.transcription, 'createdAt': card.createdAt.dateTime.toIso8601String(), - 'updatedAt': card.updatedAt?.dateTime.toIso8601String(), + 'updatedAt': card.updatedAt.dateTime.toIso8601String(), }), headers: {'Content-Type': 'application/json'}, ); @@ -97,7 +157,9 @@ class AdminCardsApiV2 { } } - @Route.post('/cards') + /// POST /api/v2/admin/cards + /// Create a new card + @Route.post('/admin/cards') Future createCard(Request request) async { try { final body = await request.readAsString(); @@ -128,7 +190,9 @@ class AdminCardsApiV2 { } } - @Route.put('/cards/') + /// PUT /api/v2/admin/cards/{cardId} + /// Update a card + @Route.put('/admin/cards/') Future updateCard(Request request, String cardId) async { try { if (cardId.isEmpty) { @@ -173,7 +237,9 @@ class AdminCardsApiV2 { } } - @Route.delete('/cards/') + /// DELETE /api/v2/admin/cards/{cardId} + /// Delete a card + @Route.delete('/admin/cards/') Future deleteCard(Request request, String cardId) async { try { if (cardId.isEmpty) { @@ -197,5 +263,5 @@ class AdminCardsApiV2 { } } - Handler get handler => _$AdminCardsApiV2Router(this); + Router get router => _$AdminCardsApiV2Router(this); } \ No newline at end of file diff --git a/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.g.dart b/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.g.dart index 3ca33c2..858dcbb 100644 --- a/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.g.dart +++ b/mnemo_cards_backend/lib/api/v2/admin_cards_api_v2.g.dart @@ -8,10 +8,10 @@ part of 'admin_cards_api_v2.dart'; Router _$AdminCardsApiV2Router(AdminCardsApiV2 service) { final router = Router(); - router.add('GET', r'/cards', service.getAllCards); - router.add('GET', r'/cards/', service.getCard); - router.add('POST', r'/cards', service.createCard); - router.add('PUT', r'/cards/', service.updateCard); - router.add('DELETE', r'/cards/', service.deleteCard); + router.add('GET', r'/admin/cards', service.getAllCards); + router.add('GET', r'/admin/cards/', service.getCard); + router.add('POST', r'/admin/cards', service.createCard); + router.add('PUT', r'/admin/cards/', service.updateCard); + router.add('DELETE', r'/admin/cards/', service.deleteCard); return router; } diff --git a/mnemo_cards_common/lib/src/dtos/user/settings/user_settings_dto.dart b/mnemo_cards_common/lib/src/dtos/user/settings/user_settings_dto.dart index c4e4420..dcb04ee 100644 --- a/mnemo_cards_common/lib/src/dtos/user/settings/user_settings_dto.dart +++ b/mnemo_cards_common/lib/src/dtos/user/settings/user_settings_dto.dart @@ -6,7 +6,7 @@ part 'user_settings_dto.g.dart'; @JsonSerializable() @CopyWith() class UserSettingsDto { - final Map packCardsOrder; + final Map packCardsOrder; UserSettingsDto({this.packCardsOrder = const {}}); @@ -19,10 +19,10 @@ class UserSettingsDto { @JsonSerializable() @CopyWith() class PackCardsOrderDto { - final int packId; + final String packId; final List cardsOrder; - PackCardsOrderDto({this.packId = -1, this.cardsOrder = const []}); + PackCardsOrderDto({this.packId = '', this.cardsOrder = const []}); factory PackCardsOrderDto.fromJson(Map json) => _$PackCardsOrderDtoFromJson(json); diff --git a/mnemo_cards_common/lib/src/dtos/user/settings/user_settings_dto.g.dart b/mnemo_cards_common/lib/src/dtos/user/settings/user_settings_dto.g.dart index df08adb..237e935 100644 --- a/mnemo_cards_common/lib/src/dtos/user/settings/user_settings_dto.g.dart +++ b/mnemo_cards_common/lib/src/dtos/user/settings/user_settings_dto.g.dart @@ -7,7 +7,7 @@ part of 'user_settings_dto.dart'; // ************************************************************************** abstract class _$UserSettingsDtoCWProxy { - UserSettingsDto packCardsOrder(Map packCardsOrder); + UserSettingsDto packCardsOrder(Map packCardsOrder); /// Creates a new instance with the provided field values. /// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `UserSettingsDto(...).copyWith.fieldName(value)`. @@ -16,7 +16,7 @@ abstract class _$UserSettingsDtoCWProxy { /// ```dart /// UserSettingsDto(...).copyWith(id: 12, name: "My name") /// ``` - UserSettingsDto call({Map packCardsOrder}); + UserSettingsDto call({Map packCardsOrder}); } /// Callable proxy for `copyWith` functionality. @@ -27,8 +27,9 @@ class _$UserSettingsDtoCWProxyImpl implements _$UserSettingsDtoCWProxy { final UserSettingsDto _value; @override - UserSettingsDto packCardsOrder(Map packCardsOrder) => - call(packCardsOrder: packCardsOrder); + UserSettingsDto packCardsOrder( + Map packCardsOrder, + ) => call(packCardsOrder: packCardsOrder); @override /// Creates a new instance with the provided field values. @@ -47,7 +48,7 @@ class _$UserSettingsDtoCWProxyImpl implements _$UserSettingsDtoCWProxy { packCardsOrder == null ? _value.packCardsOrder // ignore: cast_nullable_to_non_nullable - : packCardsOrder as Map, + : packCardsOrder as Map, ); } } @@ -60,7 +61,7 @@ extension $UserSettingsDtoCopyWith on UserSettingsDto { } abstract class _$PackCardsOrderDtoCWProxy { - PackCardsOrderDto packId(int packId); + PackCardsOrderDto packId(String packId); PackCardsOrderDto cardsOrder(List cardsOrder); @@ -71,7 +72,7 @@ abstract class _$PackCardsOrderDtoCWProxy { /// ```dart /// PackCardsOrderDto(...).copyWith(id: 12, name: "My name") /// ``` - PackCardsOrderDto call({int packId, List cardsOrder}); + PackCardsOrderDto call({String packId, List cardsOrder}); } /// Callable proxy for `copyWith` functionality. @@ -82,7 +83,7 @@ class _$PackCardsOrderDtoCWProxyImpl implements _$PackCardsOrderDtoCWProxy { final PackCardsOrderDto _value; @override - PackCardsOrderDto packId(int packId) => call(packId: packId); + PackCardsOrderDto packId(String packId) => call(packId: packId); @override PackCardsOrderDto cardsOrder(List cardsOrder) => @@ -104,7 +105,7 @@ class _$PackCardsOrderDtoCWProxyImpl implements _$PackCardsOrderDtoCWProxy { packId: packId == const $CopyWithPlaceholder() || packId == null ? _value.packId // ignore: cast_nullable_to_non_nullable - : packId as int, + : packId as String, cardsOrder: cardsOrder == const $CopyWithPlaceholder() || cardsOrder == null ? _value.cardsOrder @@ -131,7 +132,7 @@ UserSettingsDto _$UserSettingsDtoFromJson(Map json) => packCardsOrder: (json['packCardsOrder'] as Map?)?.map( (k, e) => MapEntry( - int.parse(k), + k, PackCardsOrderDto.fromJson(e as Map), ), ) ?? @@ -139,15 +140,11 @@ UserSettingsDto _$UserSettingsDtoFromJson(Map json) => ); Map _$UserSettingsDtoToJson(UserSettingsDto instance) => - { - 'packCardsOrder': instance.packCardsOrder.map( - (k, e) => MapEntry(k.toString(), e), - ), - }; + {'packCardsOrder': instance.packCardsOrder}; PackCardsOrderDto _$PackCardsOrderDtoFromJson(Map json) => PackCardsOrderDto( - packId: (json['packId'] as num?)?.toInt() ?? -1, + packId: json['packId'] as String? ?? '', cardsOrder: (json['cardsOrder'] as List?) ?.map((e) => (e as num).toInt()) diff --git a/mnemo_cards_frontend_common/pubspec.yaml b/mnemo_cards_frontend_common/pubspec.yaml index 37bcc94..d8c2202 100644 --- a/mnemo_cards_frontend_common/pubspec.yaml +++ b/mnemo_cards_frontend_common/pubspec.yaml @@ -23,7 +23,7 @@ dependencies: # firebase_crashlytics: # firebase_storage: json_serializable: - json_annotation: ^4.7.0 + json_annotation: ^4.9.0 auto_size_text: ^3.0.0 path_provider: # google_fonts: @@ -44,7 +44,7 @@ dependencies: story: ^1.1.0 flutter_screenutil: ^5.9.0 fl_chart: ^0.68.0 - yookassa_client: ^1.0.2 + yookassa_client: ^1.0.5 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 diff --git a/mnemo_cards_web_v2/lib/domain/config/api_config.dart b/mnemo_cards_web_v2/lib/domain/config/api_config.dart index 08026fc..2a04a85 100644 --- a/mnemo_cards_web_v2/lib/domain/config/api_config.dart +++ b/mnemo_cards_web_v2/lib/domain/config/api_config.dart @@ -53,7 +53,7 @@ class ApiConfig { /// /// Returns URL for loading card image by its ID /// Example: http://localhost:8000/pack/food/card/123/image - static String getCardImageUrl(String packId, int cardId) { + static String getCardImageUrl(String packId, String cardId) { return '$baseUrl/pack/$packId/card/$cardId/image'; } } diff --git a/mnemo_cards_web_v2/lib/domain/config/api_config_v2.dart b/mnemo_cards_web_v2/lib/domain/config/api_config_v2.dart index da61d8f..0ea89db 100644 --- a/mnemo_cards_web_v2/lib/domain/config/api_config_v2.dart +++ b/mnemo_cards_web_v2/lib/domain/config/api_config_v2.dart @@ -131,17 +131,17 @@ class ApiConfigV2 { /// GET /api/v2/packs/{packId}/cards/{cardId}/voices /// Get card voices metadata - static String packCardVoices(String packId, int cardId) => + static String packCardVoices(String packId, String cardId) => '/packs/$packId/cards/$cardId/voices'; /// GET /api/v2/packs/{packId}/card/{cardId}/image /// Get card image - static String packCardImage(String packId, int cardId) => + static String packCardImage(String packId, String cardId) => '/packs/$packId/cards/$cardId/image'; /// GET /api/v2/voice/{voiceId} /// Get voice file - static String voiceFile(int voiceId) => '/voice/$voiceId'; + static String voiceFile(String voiceId) => '/voice/$voiceId'; /// GET /api/v2/packs/{packId}/tests /// Get tests for a pack @@ -225,13 +225,13 @@ class ApiConfigV2 { /// Get card image URL for a specific card /// Returns: http://baseUrl/api/v2/packs/{packId}/cards/{cardId}/image - static String getCardImageUrl(String packId, int cardId) { + static String getCardImageUrl(String packId, String cardId) { return '$baseUrl${packCardImage(packId, cardId)}'; } /// Get voice file URL by id /// Returns: http://baseUrl/api/v2/voice/{voiceId} - static String getVoiceFileUrl(int voiceId) { + static String getVoiceFileUrl(String voiceId) { return '$baseUrl${voiceFile(voiceId)}'; } diff --git a/mnemo_cards_web_v2/lib/domain/models/game_question.dart b/mnemo_cards_web_v2/lib/domain/models/game_question.dart index 72f7ec5..945b06b 100644 --- a/mnemo_cards_web_v2/lib/domain/models/game_question.dart +++ b/mnemo_cards_web_v2/lib/domain/models/game_question.dart @@ -5,7 +5,7 @@ part 'game_question.g.dart'; /// Base class for all game questions @freezed -class GameQuestion with _$GameQuestion { +abstract class GameQuestion with _$GameQuestion { const factory GameQuestion.multipleChoice(MultipleChoiceQuestion question) = GameQuestionMultipleChoice; @@ -24,7 +24,7 @@ class GameQuestion with _$GameQuestion { /// Multiple choice question - user selects one correct answer from options @freezed -class MultipleChoiceQuestion with _$MultipleChoiceQuestion { +abstract class MultipleChoiceQuestion with _$MultipleChoiceQuestion { const factory MultipleChoiceQuestion({ required String id, required String question, @@ -42,7 +42,7 @@ class MultipleChoiceQuestion with _$MultipleChoiceQuestion { /// Input letters question - user fills in letters to form a word @freezed -class InputLettersQuestion with _$InputLettersQuestion { +abstract class InputLettersQuestion with _$InputLettersQuestion { const factory InputLettersQuestion({ required String id, required String template, // e.g., "H _ _ L _" @@ -59,7 +59,7 @@ class InputLettersQuestion with _$InputLettersQuestion { /// Match question - user connects items from two columns @freezed -class MatchQuestion with _$MatchQuestion { +abstract class MatchQuestion with _$MatchQuestion { const factory MatchQuestion({ required String id, required String question, @@ -77,7 +77,7 @@ class MatchQuestion with _$MatchQuestion { } @freezed -class MatchItem with _$MatchItem { +abstract class MatchItem with _$MatchItem { const factory MatchItem({ required String id, required String text, @@ -89,7 +89,7 @@ class MatchItem with _$MatchItem { } @freezed -class MatchPair with _$MatchPair { +abstract class MatchPair with _$MatchPair { const factory MatchPair({ required String leftId, required String rightId, @@ -101,7 +101,7 @@ class MatchPair with _$MatchPair { /// Matrix question - user fills in a grid/matrix @freezed -class MatrixQuestion with _$MatrixQuestion { +abstract class MatrixQuestion with _$MatrixQuestion { const factory MatrixQuestion({ required String id, required String question, @@ -119,7 +119,7 @@ class MatrixQuestion with _$MatrixQuestion { } @freezed -class MatrixCell with _$MatrixCell { +abstract class MatrixCell with _$MatrixCell { const factory MatrixCell({ required int rowIndex, required int columnIndex, @@ -132,7 +132,7 @@ class MatrixCell with _$MatrixCell { /// Question result for tracking user answers @freezed -class QuestionResult with _$QuestionResult { +abstract class QuestionResult with _$QuestionResult { const factory QuestionResult({ required String questionId, required String word, @@ -149,7 +149,7 @@ class QuestionResult with _$QuestionResult { /// Game session result @freezed -class GameSessionResult with _$GameSessionResult { +abstract class GameSessionResult with _$GameSessionResult { const factory GameSessionResult({ required String testId, required List questionResults, diff --git a/mnemo_cards_web_v2/lib/domain/models/game_question.freezed.dart b/mnemo_cards_web_v2/lib/domain/models/game_question.freezed.dart index 53ef918..41534a5 100644 --- a/mnemo_cards_web_v2/lib/domain/models/game_question.freezed.dart +++ b/mnemo_cards_web_v2/lib/domain/models/game_question.freezed.dart @@ -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,3096 +9,3110 @@ part of 'game_question.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -GameQuestion _$GameQuestionFromJson(Map json) { - switch (json['runtimeType']) { - case 'multipleChoice': - return GameQuestionMultipleChoice.fromJson(json); - case 'inputLetters': - return GameQuestionInputLetters.fromJson(json); - case 'match': - return GameQuestionMatch.fromJson(json); - case 'matrix': - return GameQuestionMatrix.fromJson(json); - - default: - throw CheckedFromJsonException(json, 'runtimeType', 'GameQuestion', - 'Invalid union type "${json['runtimeType']}"!'); - } +GameQuestion _$GameQuestionFromJson( + Map json +) { + switch (json['runtimeType']) { + case 'multipleChoice': + return GameQuestionMultipleChoice.fromJson( + json + ); + case 'inputLetters': + return GameQuestionInputLetters.fromJson( + json + ); + case 'match': + return GameQuestionMatch.fromJson( + json + ); + case 'matrix': + return GameQuestionMatrix.fromJson( + json + ); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'GameQuestion', + 'Invalid union type "${json['runtimeType']}"!' +); + } + } /// @nodoc mixin _$GameQuestion { - Object get question => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when({ - required TResult Function(MultipleChoiceQuestion question) multipleChoice, - required TResult Function(InputLettersQuestion question) inputLetters, - required TResult Function(MatchQuestion question) match, - required TResult Function(MatrixQuestion question) matrix, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(MultipleChoiceQuestion question)? multipleChoice, - TResult? Function(InputLettersQuestion question)? inputLetters, - TResult? Function(MatchQuestion question)? match, - TResult? Function(MatrixQuestion question)? matrix, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(MultipleChoiceQuestion question)? multipleChoice, - TResult Function(InputLettersQuestion question)? inputLetters, - TResult Function(MatchQuestion question)? match, - TResult Function(MatrixQuestion question)? matrix, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(GameQuestionMultipleChoice value) multipleChoice, - required TResult Function(GameQuestionInputLetters value) inputLetters, - required TResult Function(GameQuestionMatch value) match, - required TResult Function(GameQuestionMatrix value) matrix, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(GameQuestionMultipleChoice value)? multipleChoice, - TResult? Function(GameQuestionInputLetters value)? inputLetters, - TResult? Function(GameQuestionMatch value)? match, - TResult? Function(GameQuestionMatrix value)? matrix, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(GameQuestionMultipleChoice value)? multipleChoice, - TResult Function(GameQuestionInputLetters value)? inputLetters, - TResult Function(GameQuestionMatch value)? match, - TResult Function(GameQuestionMatrix value)? matrix, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; + + Object get question; + + /// Serializes this GameQuestion to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GameQuestion&&const DeepCollectionEquality().equals(other.question, question)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(question)); + +@override +String toString() { + return 'GameQuestion(question: $question)'; +} + + } /// @nodoc -abstract class $GameQuestionCopyWith<$Res> { - factory $GameQuestionCopyWith( - GameQuestion value, $Res Function(GameQuestion) then) = - _$GameQuestionCopyWithImpl<$Res, GameQuestion>; +class $GameQuestionCopyWith<$Res> { +$GameQuestionCopyWith(GameQuestion _, $Res Function(GameQuestion) __); } -/// @nodoc -class _$GameQuestionCopyWithImpl<$Res, $Val extends GameQuestion> - implements $GameQuestionCopyWith<$Res> { - _$GameQuestionCopyWithImpl(this._value, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; +/// Adds pattern-matching-related methods to [GameQuestion]. +extension GameQuestionPatterns on GameQuestion { +/// 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 Function( GameQuestionMultipleChoice value)? multipleChoice,TResult Function( GameQuestionInputLetters value)? inputLetters,TResult Function( GameQuestionMatch value)? match,TResult Function( GameQuestionMatrix value)? matrix,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case GameQuestionMultipleChoice() when multipleChoice != null: +return multipleChoice(_that);case GameQuestionInputLetters() when inputLetters != null: +return inputLetters(_that);case GameQuestionMatch() when match != null: +return match(_that);case GameQuestionMatrix() when matrix != null: +return matrix(_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({required TResult Function( GameQuestionMultipleChoice value) multipleChoice,required TResult Function( GameQuestionInputLetters value) inputLetters,required TResult Function( GameQuestionMatch value) match,required TResult Function( GameQuestionMatrix value) matrix,}){ +final _that = this; +switch (_that) { +case GameQuestionMultipleChoice(): +return multipleChoice(_that);case GameQuestionInputLetters(): +return inputLetters(_that);case GameQuestionMatch(): +return match(_that);case GameQuestionMatrix(): +return matrix(_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? Function( GameQuestionMultipleChoice value)? multipleChoice,TResult? Function( GameQuestionInputLetters value)? inputLetters,TResult? Function( GameQuestionMatch value)? match,TResult? Function( GameQuestionMatrix value)? matrix,}){ +final _that = this; +switch (_that) { +case GameQuestionMultipleChoice() when multipleChoice != null: +return multipleChoice(_that);case GameQuestionInputLetters() when inputLetters != null: +return inputLetters(_that);case GameQuestionMatch() when match != null: +return match(_that);case GameQuestionMatrix() when matrix != null: +return matrix(_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 Function( MultipleChoiceQuestion question)? multipleChoice,TResult Function( InputLettersQuestion question)? inputLetters,TResult Function( MatchQuestion question)? match,TResult Function( MatrixQuestion question)? matrix,required TResult orElse(),}) {final _that = this; +switch (_that) { +case GameQuestionMultipleChoice() when multipleChoice != null: +return multipleChoice(_that.question);case GameQuestionInputLetters() when inputLetters != null: +return inputLetters(_that.question);case GameQuestionMatch() when match != null: +return match(_that.question);case GameQuestionMatrix() when matrix != null: +return matrix(_that.question);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({required TResult Function( MultipleChoiceQuestion question) multipleChoice,required TResult Function( InputLettersQuestion question) inputLetters,required TResult Function( MatchQuestion question) match,required TResult Function( MatrixQuestion question) matrix,}) {final _that = this; +switch (_that) { +case GameQuestionMultipleChoice(): +return multipleChoice(_that.question);case GameQuestionInputLetters(): +return inputLetters(_that.question);case GameQuestionMatch(): +return match(_that.question);case GameQuestionMatrix(): +return matrix(_that.question);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? Function( MultipleChoiceQuestion question)? multipleChoice,TResult? Function( InputLettersQuestion question)? inputLetters,TResult? Function( MatchQuestion question)? match,TResult? Function( MatrixQuestion question)? matrix,}) {final _that = this; +switch (_that) { +case GameQuestionMultipleChoice() when multipleChoice != null: +return multipleChoice(_that.question);case GameQuestionInputLetters() when inputLetters != null: +return inputLetters(_that.question);case GameQuestionMatch() when match != null: +return match(_that.question);case GameQuestionMatrix() when matrix != null: +return matrix(_that.question);case _: + return null; + +} } -/// @nodoc -abstract class _$$GameQuestionMultipleChoiceImplCopyWith<$Res> { - factory _$$GameQuestionMultipleChoiceImplCopyWith( - _$GameQuestionMultipleChoiceImpl value, - $Res Function(_$GameQuestionMultipleChoiceImpl) then) = - __$$GameQuestionMultipleChoiceImplCopyWithImpl<$Res>; - @useResult - $Res call({MultipleChoiceQuestion question}); - - $MultipleChoiceQuestionCopyWith<$Res> get question; -} - -/// @nodoc -class __$$GameQuestionMultipleChoiceImplCopyWithImpl<$Res> - extends _$GameQuestionCopyWithImpl<$Res, _$GameQuestionMultipleChoiceImpl> - implements _$$GameQuestionMultipleChoiceImplCopyWith<$Res> { - __$$GameQuestionMultipleChoiceImplCopyWithImpl( - _$GameQuestionMultipleChoiceImpl _value, - $Res Function(_$GameQuestionMultipleChoiceImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? question = null, - }) { - return _then(_$GameQuestionMultipleChoiceImpl( - null == question - ? _value.question - : question // ignore: cast_nullable_to_non_nullable - as MultipleChoiceQuestion, - )); - } - - @override - @pragma('vm:prefer-inline') - $MultipleChoiceQuestionCopyWith<$Res> get question { - return $MultipleChoiceQuestionCopyWith<$Res>(_value.question, (value) { - return _then(_value.copyWith(question: value)); - }); - } } /// @nodoc @JsonSerializable() -class _$GameQuestionMultipleChoiceImpl implements GameQuestionMultipleChoice { - const _$GameQuestionMultipleChoiceImpl(this.question, {final String? $type}) - : $type = $type ?? 'multipleChoice'; - factory _$GameQuestionMultipleChoiceImpl.fromJson( - Map json) => - _$$GameQuestionMultipleChoiceImplFromJson(json); +class GameQuestionMultipleChoice implements GameQuestion { + const GameQuestionMultipleChoice(this.question, {final String? $type}): $type = $type ?? 'multipleChoice'; + factory GameQuestionMultipleChoice.fromJson(Map json) => _$GameQuestionMultipleChoiceFromJson(json); - @override - final MultipleChoiceQuestion question; +@override final MultipleChoiceQuestion question; - @JsonKey(name: 'runtimeType') - final String $type; +@JsonKey(name: 'runtimeType') +final String $type; - @override - String toString() { - return 'GameQuestion.multipleChoice(question: $question)'; - } - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$GameQuestionMultipleChoiceImpl && - (identical(other.question, question) || - other.question == question)); - } +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GameQuestionMultipleChoiceCopyWith get copyWith => _$GameQuestionMultipleChoiceCopyWithImpl(this, _$identity); - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash(runtimeType, question); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$GameQuestionMultipleChoiceImplCopyWith<_$GameQuestionMultipleChoiceImpl> - get copyWith => __$$GameQuestionMultipleChoiceImplCopyWithImpl< - _$GameQuestionMultipleChoiceImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(MultipleChoiceQuestion question) multipleChoice, - required TResult Function(InputLettersQuestion question) inputLetters, - required TResult Function(MatchQuestion question) match, - required TResult Function(MatrixQuestion question) matrix, - }) { - return multipleChoice(question); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(MultipleChoiceQuestion question)? multipleChoice, - TResult? Function(InputLettersQuestion question)? inputLetters, - TResult? Function(MatchQuestion question)? match, - TResult? Function(MatrixQuestion question)? matrix, - }) { - return multipleChoice?.call(question); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(MultipleChoiceQuestion question)? multipleChoice, - TResult Function(InputLettersQuestion question)? inputLetters, - TResult Function(MatchQuestion question)? match, - TResult Function(MatrixQuestion question)? matrix, - required TResult orElse(), - }) { - if (multipleChoice != null) { - return multipleChoice(question); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(GameQuestionMultipleChoice value) multipleChoice, - required TResult Function(GameQuestionInputLetters value) inputLetters, - required TResult Function(GameQuestionMatch value) match, - required TResult Function(GameQuestionMatrix value) matrix, - }) { - return multipleChoice(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(GameQuestionMultipleChoice value)? multipleChoice, - TResult? Function(GameQuestionInputLetters value)? inputLetters, - TResult? Function(GameQuestionMatch value)? match, - TResult? Function(GameQuestionMatrix value)? matrix, - }) { - return multipleChoice?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(GameQuestionMultipleChoice value)? multipleChoice, - TResult Function(GameQuestionInputLetters value)? inputLetters, - TResult Function(GameQuestionMatch value)? match, - TResult Function(GameQuestionMatrix value)? matrix, - required TResult orElse(), - }) { - if (multipleChoice != null) { - return multipleChoice(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$GameQuestionMultipleChoiceImplToJson( - this, - ); - } +@override +Map toJson() { + return _$GameQuestionMultipleChoiceToJson(this, ); } -abstract class GameQuestionMultipleChoice implements GameQuestion { - const factory GameQuestionMultipleChoice( - final MultipleChoiceQuestion question) = _$GameQuestionMultipleChoiceImpl; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GameQuestionMultipleChoice&&(identical(other.question, question) || other.question == question)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,question); + +@override +String toString() { + return 'GameQuestion.multipleChoice(question: $question)'; +} - factory GameQuestionMultipleChoice.fromJson(Map json) = - _$GameQuestionMultipleChoiceImpl.fromJson; - @override - MultipleChoiceQuestion get question; - @JsonKey(ignore: true) - _$$GameQuestionMultipleChoiceImplCopyWith<_$GameQuestionMultipleChoiceImpl> - get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$GameQuestionInputLettersImplCopyWith<$Res> { - factory _$$GameQuestionInputLettersImplCopyWith( - _$GameQuestionInputLettersImpl value, - $Res Function(_$GameQuestionInputLettersImpl) then) = - __$$GameQuestionInputLettersImplCopyWithImpl<$Res>; - @useResult - $Res call({InputLettersQuestion question}); +abstract mixin class $GameQuestionMultipleChoiceCopyWith<$Res> implements $GameQuestionCopyWith<$Res> { + factory $GameQuestionMultipleChoiceCopyWith(GameQuestionMultipleChoice value, $Res Function(GameQuestionMultipleChoice) _then) = _$GameQuestionMultipleChoiceCopyWithImpl; +@useResult +$Res call({ + MultipleChoiceQuestion question +}); - $InputLettersQuestionCopyWith<$Res> get question; + +$MultipleChoiceQuestionCopyWith<$Res> get question; + +} +/// @nodoc +class _$GameQuestionMultipleChoiceCopyWithImpl<$Res> + implements $GameQuestionMultipleChoiceCopyWith<$Res> { + _$GameQuestionMultipleChoiceCopyWithImpl(this._self, this._then); + + final GameQuestionMultipleChoice _self; + final $Res Function(GameQuestionMultipleChoice) _then; + +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? question = null,}) { + return _then(GameQuestionMultipleChoice( +null == question ? _self.question : question // ignore: cast_nullable_to_non_nullable +as MultipleChoiceQuestion, + )); } -/// @nodoc -class __$$GameQuestionInputLettersImplCopyWithImpl<$Res> - extends _$GameQuestionCopyWithImpl<$Res, _$GameQuestionInputLettersImpl> - implements _$$GameQuestionInputLettersImplCopyWith<$Res> { - __$$GameQuestionInputLettersImplCopyWithImpl( - _$GameQuestionInputLettersImpl _value, - $Res Function(_$GameQuestionInputLettersImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? question = null, - }) { - return _then(_$GameQuestionInputLettersImpl( - null == question - ? _value.question - : question // ignore: cast_nullable_to_non_nullable - as InputLettersQuestion, - )); - } - - @override - @pragma('vm:prefer-inline') - $InputLettersQuestionCopyWith<$Res> get question { - return $InputLettersQuestionCopyWith<$Res>(_value.question, (value) { - return _then(_value.copyWith(question: value)); - }); - } +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$MultipleChoiceQuestionCopyWith<$Res> get question { + + return $MultipleChoiceQuestionCopyWith<$Res>(_self.question, (value) { + return _then(_self.copyWith(question: value)); + }); +} } /// @nodoc @JsonSerializable() -class _$GameQuestionInputLettersImpl implements GameQuestionInputLetters { - const _$GameQuestionInputLettersImpl(this.question, {final String? $type}) - : $type = $type ?? 'inputLetters'; - factory _$GameQuestionInputLettersImpl.fromJson(Map json) => - _$$GameQuestionInputLettersImplFromJson(json); +class GameQuestionInputLetters implements GameQuestion { + const GameQuestionInputLetters(this.question, {final String? $type}): $type = $type ?? 'inputLetters'; + factory GameQuestionInputLetters.fromJson(Map json) => _$GameQuestionInputLettersFromJson(json); - @override - final InputLettersQuestion question; +@override final InputLettersQuestion question; - @JsonKey(name: 'runtimeType') - final String $type; +@JsonKey(name: 'runtimeType') +final String $type; - @override - String toString() { - return 'GameQuestion.inputLetters(question: $question)'; - } - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$GameQuestionInputLettersImpl && - (identical(other.question, question) || - other.question == question)); - } +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GameQuestionInputLettersCopyWith get copyWith => _$GameQuestionInputLettersCopyWithImpl(this, _$identity); - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash(runtimeType, question); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$GameQuestionInputLettersImplCopyWith<_$GameQuestionInputLettersImpl> - get copyWith => __$$GameQuestionInputLettersImplCopyWithImpl< - _$GameQuestionInputLettersImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(MultipleChoiceQuestion question) multipleChoice, - required TResult Function(InputLettersQuestion question) inputLetters, - required TResult Function(MatchQuestion question) match, - required TResult Function(MatrixQuestion question) matrix, - }) { - return inputLetters(question); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(MultipleChoiceQuestion question)? multipleChoice, - TResult? Function(InputLettersQuestion question)? inputLetters, - TResult? Function(MatchQuestion question)? match, - TResult? Function(MatrixQuestion question)? matrix, - }) { - return inputLetters?.call(question); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(MultipleChoiceQuestion question)? multipleChoice, - TResult Function(InputLettersQuestion question)? inputLetters, - TResult Function(MatchQuestion question)? match, - TResult Function(MatrixQuestion question)? matrix, - required TResult orElse(), - }) { - if (inputLetters != null) { - return inputLetters(question); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(GameQuestionMultipleChoice value) multipleChoice, - required TResult Function(GameQuestionInputLetters value) inputLetters, - required TResult Function(GameQuestionMatch value) match, - required TResult Function(GameQuestionMatrix value) matrix, - }) { - return inputLetters(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(GameQuestionMultipleChoice value)? multipleChoice, - TResult? Function(GameQuestionInputLetters value)? inputLetters, - TResult? Function(GameQuestionMatch value)? match, - TResult? Function(GameQuestionMatrix value)? matrix, - }) { - return inputLetters?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(GameQuestionMultipleChoice value)? multipleChoice, - TResult Function(GameQuestionInputLetters value)? inputLetters, - TResult Function(GameQuestionMatch value)? match, - TResult Function(GameQuestionMatrix value)? matrix, - required TResult orElse(), - }) { - if (inputLetters != null) { - return inputLetters(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$GameQuestionInputLettersImplToJson( - this, - ); - } +@override +Map toJson() { + return _$GameQuestionInputLettersToJson(this, ); } -abstract class GameQuestionInputLetters implements GameQuestion { - const factory GameQuestionInputLetters(final InputLettersQuestion question) = - _$GameQuestionInputLettersImpl; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GameQuestionInputLetters&&(identical(other.question, question) || other.question == question)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,question); + +@override +String toString() { + return 'GameQuestion.inputLetters(question: $question)'; +} - factory GameQuestionInputLetters.fromJson(Map json) = - _$GameQuestionInputLettersImpl.fromJson; - @override - InputLettersQuestion get question; - @JsonKey(ignore: true) - _$$GameQuestionInputLettersImplCopyWith<_$GameQuestionInputLettersImpl> - get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$GameQuestionMatchImplCopyWith<$Res> { - factory _$$GameQuestionMatchImplCopyWith(_$GameQuestionMatchImpl value, - $Res Function(_$GameQuestionMatchImpl) then) = - __$$GameQuestionMatchImplCopyWithImpl<$Res>; - @useResult - $Res call({MatchQuestion question}); +abstract mixin class $GameQuestionInputLettersCopyWith<$Res> implements $GameQuestionCopyWith<$Res> { + factory $GameQuestionInputLettersCopyWith(GameQuestionInputLetters value, $Res Function(GameQuestionInputLetters) _then) = _$GameQuestionInputLettersCopyWithImpl; +@useResult +$Res call({ + InputLettersQuestion question +}); - $MatchQuestionCopyWith<$Res> get question; + +$InputLettersQuestionCopyWith<$Res> get question; + +} +/// @nodoc +class _$GameQuestionInputLettersCopyWithImpl<$Res> + implements $GameQuestionInputLettersCopyWith<$Res> { + _$GameQuestionInputLettersCopyWithImpl(this._self, this._then); + + final GameQuestionInputLetters _self; + final $Res Function(GameQuestionInputLetters) _then; + +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? question = null,}) { + return _then(GameQuestionInputLetters( +null == question ? _self.question : question // ignore: cast_nullable_to_non_nullable +as InputLettersQuestion, + )); } -/// @nodoc -class __$$GameQuestionMatchImplCopyWithImpl<$Res> - extends _$GameQuestionCopyWithImpl<$Res, _$GameQuestionMatchImpl> - implements _$$GameQuestionMatchImplCopyWith<$Res> { - __$$GameQuestionMatchImplCopyWithImpl(_$GameQuestionMatchImpl _value, - $Res Function(_$GameQuestionMatchImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? question = null, - }) { - return _then(_$GameQuestionMatchImpl( - null == question - ? _value.question - : question // ignore: cast_nullable_to_non_nullable - as MatchQuestion, - )); - } - - @override - @pragma('vm:prefer-inline') - $MatchQuestionCopyWith<$Res> get question { - return $MatchQuestionCopyWith<$Res>(_value.question, (value) { - return _then(_value.copyWith(question: value)); - }); - } +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$InputLettersQuestionCopyWith<$Res> get question { + + return $InputLettersQuestionCopyWith<$Res>(_self.question, (value) { + return _then(_self.copyWith(question: value)); + }); +} } /// @nodoc @JsonSerializable() -class _$GameQuestionMatchImpl implements GameQuestionMatch { - const _$GameQuestionMatchImpl(this.question, {final String? $type}) - : $type = $type ?? 'match'; - factory _$GameQuestionMatchImpl.fromJson(Map json) => - _$$GameQuestionMatchImplFromJson(json); +class GameQuestionMatch implements GameQuestion { + const GameQuestionMatch(this.question, {final String? $type}): $type = $type ?? 'match'; + factory GameQuestionMatch.fromJson(Map json) => _$GameQuestionMatchFromJson(json); - @override - final MatchQuestion question; +@override final MatchQuestion question; - @JsonKey(name: 'runtimeType') - final String $type; +@JsonKey(name: 'runtimeType') +final String $type; - @override - String toString() { - return 'GameQuestion.match(question: $question)'; - } - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$GameQuestionMatchImpl && - (identical(other.question, question) || - other.question == question)); - } +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GameQuestionMatchCopyWith get copyWith => _$GameQuestionMatchCopyWithImpl(this, _$identity); - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash(runtimeType, question); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$GameQuestionMatchImplCopyWith<_$GameQuestionMatchImpl> get copyWith => - __$$GameQuestionMatchImplCopyWithImpl<_$GameQuestionMatchImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(MultipleChoiceQuestion question) multipleChoice, - required TResult Function(InputLettersQuestion question) inputLetters, - required TResult Function(MatchQuestion question) match, - required TResult Function(MatrixQuestion question) matrix, - }) { - return match(question); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(MultipleChoiceQuestion question)? multipleChoice, - TResult? Function(InputLettersQuestion question)? inputLetters, - TResult? Function(MatchQuestion question)? match, - TResult? Function(MatrixQuestion question)? matrix, - }) { - return match?.call(question); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(MultipleChoiceQuestion question)? multipleChoice, - TResult Function(InputLettersQuestion question)? inputLetters, - TResult Function(MatchQuestion question)? match, - TResult Function(MatrixQuestion question)? matrix, - required TResult orElse(), - }) { - if (match != null) { - return match(question); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(GameQuestionMultipleChoice value) multipleChoice, - required TResult Function(GameQuestionInputLetters value) inputLetters, - required TResult Function(GameQuestionMatch value) match, - required TResult Function(GameQuestionMatrix value) matrix, - }) { - return match(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(GameQuestionMultipleChoice value)? multipleChoice, - TResult? Function(GameQuestionInputLetters value)? inputLetters, - TResult? Function(GameQuestionMatch value)? match, - TResult? Function(GameQuestionMatrix value)? matrix, - }) { - return match?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(GameQuestionMultipleChoice value)? multipleChoice, - TResult Function(GameQuestionInputLetters value)? inputLetters, - TResult Function(GameQuestionMatch value)? match, - TResult Function(GameQuestionMatrix value)? matrix, - required TResult orElse(), - }) { - if (match != null) { - return match(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$GameQuestionMatchImplToJson( - this, - ); - } +@override +Map toJson() { + return _$GameQuestionMatchToJson(this, ); } -abstract class GameQuestionMatch implements GameQuestion { - const factory GameQuestionMatch(final MatchQuestion question) = - _$GameQuestionMatchImpl; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GameQuestionMatch&&(identical(other.question, question) || other.question == question)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,question); + +@override +String toString() { + return 'GameQuestion.match(question: $question)'; +} - factory GameQuestionMatch.fromJson(Map json) = - _$GameQuestionMatchImpl.fromJson; - @override - MatchQuestion get question; - @JsonKey(ignore: true) - _$$GameQuestionMatchImplCopyWith<_$GameQuestionMatchImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$GameQuestionMatrixImplCopyWith<$Res> { - factory _$$GameQuestionMatrixImplCopyWith(_$GameQuestionMatrixImpl value, - $Res Function(_$GameQuestionMatrixImpl) then) = - __$$GameQuestionMatrixImplCopyWithImpl<$Res>; - @useResult - $Res call({MatrixQuestion question}); +abstract mixin class $GameQuestionMatchCopyWith<$Res> implements $GameQuestionCopyWith<$Res> { + factory $GameQuestionMatchCopyWith(GameQuestionMatch value, $Res Function(GameQuestionMatch) _then) = _$GameQuestionMatchCopyWithImpl; +@useResult +$Res call({ + MatchQuestion question +}); - $MatrixQuestionCopyWith<$Res> get question; + +$MatchQuestionCopyWith<$Res> get question; + +} +/// @nodoc +class _$GameQuestionMatchCopyWithImpl<$Res> + implements $GameQuestionMatchCopyWith<$Res> { + _$GameQuestionMatchCopyWithImpl(this._self, this._then); + + final GameQuestionMatch _self; + final $Res Function(GameQuestionMatch) _then; + +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? question = null,}) { + return _then(GameQuestionMatch( +null == question ? _self.question : question // ignore: cast_nullable_to_non_nullable +as MatchQuestion, + )); } -/// @nodoc -class __$$GameQuestionMatrixImplCopyWithImpl<$Res> - extends _$GameQuestionCopyWithImpl<$Res, _$GameQuestionMatrixImpl> - implements _$$GameQuestionMatrixImplCopyWith<$Res> { - __$$GameQuestionMatrixImplCopyWithImpl(_$GameQuestionMatrixImpl _value, - $Res Function(_$GameQuestionMatrixImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? question = null, - }) { - return _then(_$GameQuestionMatrixImpl( - null == question - ? _value.question - : question // ignore: cast_nullable_to_non_nullable - as MatrixQuestion, - )); - } - - @override - @pragma('vm:prefer-inline') - $MatrixQuestionCopyWith<$Res> get question { - return $MatrixQuestionCopyWith<$Res>(_value.question, (value) { - return _then(_value.copyWith(question: value)); - }); - } +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$MatchQuestionCopyWith<$Res> get question { + + return $MatchQuestionCopyWith<$Res>(_self.question, (value) { + return _then(_self.copyWith(question: value)); + }); +} } /// @nodoc @JsonSerializable() -class _$GameQuestionMatrixImpl implements GameQuestionMatrix { - const _$GameQuestionMatrixImpl(this.question, {final String? $type}) - : $type = $type ?? 'matrix'; - factory _$GameQuestionMatrixImpl.fromJson(Map json) => - _$$GameQuestionMatrixImplFromJson(json); +class GameQuestionMatrix implements GameQuestion { + const GameQuestionMatrix(this.question, {final String? $type}): $type = $type ?? 'matrix'; + factory GameQuestionMatrix.fromJson(Map json) => _$GameQuestionMatrixFromJson(json); - @override - final MatrixQuestion question; +@override final MatrixQuestion question; - @JsonKey(name: 'runtimeType') - final String $type; +@JsonKey(name: 'runtimeType') +final String $type; - @override - String toString() { - return 'GameQuestion.matrix(question: $question)'; - } - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$GameQuestionMatrixImpl && - (identical(other.question, question) || - other.question == question)); - } +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GameQuestionMatrixCopyWith get copyWith => _$GameQuestionMatrixCopyWithImpl(this, _$identity); - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash(runtimeType, question); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$GameQuestionMatrixImplCopyWith<_$GameQuestionMatrixImpl> get copyWith => - __$$GameQuestionMatrixImplCopyWithImpl<_$GameQuestionMatrixImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(MultipleChoiceQuestion question) multipleChoice, - required TResult Function(InputLettersQuestion question) inputLetters, - required TResult Function(MatchQuestion question) match, - required TResult Function(MatrixQuestion question) matrix, - }) { - return matrix(question); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(MultipleChoiceQuestion question)? multipleChoice, - TResult? Function(InputLettersQuestion question)? inputLetters, - TResult? Function(MatchQuestion question)? match, - TResult? Function(MatrixQuestion question)? matrix, - }) { - return matrix?.call(question); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(MultipleChoiceQuestion question)? multipleChoice, - TResult Function(InputLettersQuestion question)? inputLetters, - TResult Function(MatchQuestion question)? match, - TResult Function(MatrixQuestion question)? matrix, - required TResult orElse(), - }) { - if (matrix != null) { - return matrix(question); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(GameQuestionMultipleChoice value) multipleChoice, - required TResult Function(GameQuestionInputLetters value) inputLetters, - required TResult Function(GameQuestionMatch value) match, - required TResult Function(GameQuestionMatrix value) matrix, - }) { - return matrix(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(GameQuestionMultipleChoice value)? multipleChoice, - TResult? Function(GameQuestionInputLetters value)? inputLetters, - TResult? Function(GameQuestionMatch value)? match, - TResult? Function(GameQuestionMatrix value)? matrix, - }) { - return matrix?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(GameQuestionMultipleChoice value)? multipleChoice, - TResult Function(GameQuestionInputLetters value)? inputLetters, - TResult Function(GameQuestionMatch value)? match, - TResult Function(GameQuestionMatrix value)? matrix, - required TResult orElse(), - }) { - if (matrix != null) { - return matrix(this); - } - return orElse(); - } - - @override - Map toJson() { - return _$$GameQuestionMatrixImplToJson( - this, - ); - } +@override +Map toJson() { + return _$GameQuestionMatrixToJson(this, ); } -abstract class GameQuestionMatrix implements GameQuestion { - const factory GameQuestionMatrix(final MatrixQuestion question) = - _$GameQuestionMatrixImpl; - - factory GameQuestionMatrix.fromJson(Map json) = - _$GameQuestionMatrixImpl.fromJson; - - @override - MatrixQuestion get question; - @JsonKey(ignore: true) - _$$GameQuestionMatrixImplCopyWith<_$GameQuestionMatrixImpl> get copyWith => - throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GameQuestionMatrix&&(identical(other.question, question) || other.question == question)); } -MultipleChoiceQuestion _$MultipleChoiceQuestionFromJson( - Map json) { - return _MultipleChoiceQuestion.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,question); + +@override +String toString() { + return 'GameQuestion.matrix(question: $question)'; } + +} + +/// @nodoc +abstract mixin class $GameQuestionMatrixCopyWith<$Res> implements $GameQuestionCopyWith<$Res> { + factory $GameQuestionMatrixCopyWith(GameQuestionMatrix value, $Res Function(GameQuestionMatrix) _then) = _$GameQuestionMatrixCopyWithImpl; +@useResult +$Res call({ + MatrixQuestion question +}); + + +$MatrixQuestionCopyWith<$Res> get question; + +} +/// @nodoc +class _$GameQuestionMatrixCopyWithImpl<$Res> + implements $GameQuestionMatrixCopyWith<$Res> { + _$GameQuestionMatrixCopyWithImpl(this._self, this._then); + + final GameQuestionMatrix _self; + final $Res Function(GameQuestionMatrix) _then; + +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? question = null,}) { + return _then(GameQuestionMatrix( +null == question ? _self.question : question // ignore: cast_nullable_to_non_nullable +as MatrixQuestion, + )); +} + +/// Create a copy of GameQuestion +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$MatrixQuestionCopyWith<$Res> get question { + + return $MatrixQuestionCopyWith<$Res>(_self.question, (value) { + return _then(_self.copyWith(question: value)); + }); +} +} + + /// @nodoc mixin _$MultipleChoiceQuestion { - String get id => throw _privateConstructorUsedError; - String get question => throw _privateConstructorUsedError; - String? get image => throw _privateConstructorUsedError; - String? get audio => throw _privateConstructorUsedError; - List get options => throw _privateConstructorUsedError; - String get correctAnswer => throw _privateConstructorUsedError; - String get word => - throw _privateConstructorUsedError; // associated word for statistics - String get type => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $MultipleChoiceQuestionCopyWith get copyWith => - throw _privateConstructorUsedError; + String get id; String get question; String? get image; String? get audio; List get options; String get correctAnswer; String get word;// associated word for statistics + String get type; +/// Create a copy of MultipleChoiceQuestion +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$MultipleChoiceQuestionCopyWith get copyWith => _$MultipleChoiceQuestionCopyWithImpl(this as MultipleChoiceQuestion, _$identity); + + /// Serializes this MultipleChoiceQuestion to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is MultipleChoiceQuestion&&(identical(other.id, id) || other.id == id)&&(identical(other.question, question) || other.question == question)&&(identical(other.image, image) || other.image == image)&&(identical(other.audio, audio) || other.audio == audio)&&const DeepCollectionEquality().equals(other.options, options)&&(identical(other.correctAnswer, correctAnswer) || other.correctAnswer == correctAnswer)&&(identical(other.word, word) || other.word == word)&&(identical(other.type, type) || other.type == type)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,question,image,audio,const DeepCollectionEquality().hash(options),correctAnswer,word,type); + +@override +String toString() { + return 'MultipleChoiceQuestion(id: $id, question: $question, image: $image, audio: $audio, options: $options, correctAnswer: $correctAnswer, word: $word, type: $type)'; +} + + } /// @nodoc -abstract class $MultipleChoiceQuestionCopyWith<$Res> { - factory $MultipleChoiceQuestionCopyWith(MultipleChoiceQuestion value, - $Res Function(MultipleChoiceQuestion) then) = - _$MultipleChoiceQuestionCopyWithImpl<$Res, MultipleChoiceQuestion>; - @useResult - $Res call( - {String id, - String question, - String? image, - String? audio, - List options, - String correctAnswer, - String word, - String type}); -} +abstract mixin class $MultipleChoiceQuestionCopyWith<$Res> { + factory $MultipleChoiceQuestionCopyWith(MultipleChoiceQuestion value, $Res Function(MultipleChoiceQuestion) _then) = _$MultipleChoiceQuestionCopyWithImpl; +@useResult +$Res call({ + String id, String question, String? image, String? audio, List options, String correctAnswer, String word, String type +}); + + + +} /// @nodoc -class _$MultipleChoiceQuestionCopyWithImpl<$Res, - $Val extends MultipleChoiceQuestion> +class _$MultipleChoiceQuestionCopyWithImpl<$Res> implements $MultipleChoiceQuestionCopyWith<$Res> { - _$MultipleChoiceQuestionCopyWithImpl(this._value, this._then); + _$MultipleChoiceQuestionCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final MultipleChoiceQuestion _self; + final $Res Function(MultipleChoiceQuestion) _then; - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? question = null, - Object? image = freezed, - Object? audio = freezed, - Object? options = null, - Object? correctAnswer = null, - Object? word = null, - Object? type = null, - }) { - return _then(_value.copyWith( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - question: null == question - ? _value.question - : question // ignore: cast_nullable_to_non_nullable - as String, - image: freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - audio: freezed == audio - ? _value.audio - : audio // ignore: cast_nullable_to_non_nullable - as String?, - options: null == options - ? _value.options - : options // ignore: cast_nullable_to_non_nullable - as List, - correctAnswer: null == correctAnswer - ? _value.correctAnswer - : correctAnswer // ignore: cast_nullable_to_non_nullable - as String, - word: null == word - ? _value.word - : word // ignore: cast_nullable_to_non_nullable - as String, - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String, - ) as $Val); - } +/// Create a copy of MultipleChoiceQuestion +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? question = null,Object? image = freezed,Object? audio = freezed,Object? options = null,Object? correctAnswer = null,Object? word = null,Object? type = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,question: null == question ? _self.question : question // ignore: cast_nullable_to_non_nullable +as String,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?,audio: freezed == audio ? _self.audio : audio // ignore: cast_nullable_to_non_nullable +as String?,options: null == options ? _self.options : options // ignore: cast_nullable_to_non_nullable +as List,correctAnswer: null == correctAnswer ? _self.correctAnswer : correctAnswer // ignore: cast_nullable_to_non_nullable +as String,word: null == word ? _self.word : word // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -abstract class _$$MultipleChoiceQuestionImplCopyWith<$Res> - implements $MultipleChoiceQuestionCopyWith<$Res> { - factory _$$MultipleChoiceQuestionImplCopyWith( - _$MultipleChoiceQuestionImpl value, - $Res Function(_$MultipleChoiceQuestionImpl) then) = - __$$MultipleChoiceQuestionImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String id, - String question, - String? image, - String? audio, - List options, - String correctAnswer, - String word, - String type}); } -/// @nodoc -class __$$MultipleChoiceQuestionImplCopyWithImpl<$Res> - extends _$MultipleChoiceQuestionCopyWithImpl<$Res, - _$MultipleChoiceQuestionImpl> - implements _$$MultipleChoiceQuestionImplCopyWith<$Res> { - __$$MultipleChoiceQuestionImplCopyWithImpl( - _$MultipleChoiceQuestionImpl _value, - $Res Function(_$MultipleChoiceQuestionImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? question = null, - Object? image = freezed, - Object? audio = freezed, - Object? options = null, - Object? correctAnswer = null, - Object? word = null, - Object? type = null, - }) { - return _then(_$MultipleChoiceQuestionImpl( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - question: null == question - ? _value.question - : question // ignore: cast_nullable_to_non_nullable - as String, - image: freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - audio: freezed == audio - ? _value.audio - : audio // ignore: cast_nullable_to_non_nullable - as String?, - options: null == options - ? _value._options - : options // ignore: cast_nullable_to_non_nullable - as List, - correctAnswer: null == correctAnswer - ? _value.correctAnswer - : correctAnswer // ignore: cast_nullable_to_non_nullable - as String, - word: null == word - ? _value.word - : word // ignore: cast_nullable_to_non_nullable - as String, - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String, - )); - } +/// Adds pattern-matching-related methods to [MultipleChoiceQuestion]. +extension MultipleChoiceQuestionPatterns on MultipleChoiceQuestion { +/// 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 Function( _MultipleChoiceQuestion value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _MultipleChoiceQuestion() 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 Function( _MultipleChoiceQuestion value) $default,){ +final _that = this; +switch (_that) { +case _MultipleChoiceQuestion(): +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? Function( _MultipleChoiceQuestion value)? $default,){ +final _that = this; +switch (_that) { +case _MultipleChoiceQuestion() 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 Function( String id, String question, String? image, String? audio, List options, String correctAnswer, String word, String type)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _MultipleChoiceQuestion() when $default != null: +return $default(_that.id,_that.question,_that.image,_that.audio,_that.options,_that.correctAnswer,_that.word,_that.type);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 Function( String id, String question, String? image, String? audio, List options, String correctAnswer, String word, String type) $default,) {final _that = this; +switch (_that) { +case _MultipleChoiceQuestion(): +return $default(_that.id,_that.question,_that.image,_that.audio,_that.options,_that.correctAnswer,_that.word,_that.type);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? Function( String id, String question, String? image, String? audio, List options, String correctAnswer, String word, String type)? $default,) {final _that = this; +switch (_that) { +case _MultipleChoiceQuestion() when $default != null: +return $default(_that.id,_that.question,_that.image,_that.audio,_that.options,_that.correctAnswer,_that.word,_that.type);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$MultipleChoiceQuestionImpl implements _MultipleChoiceQuestion { - const _$MultipleChoiceQuestionImpl( - {required this.id, - required this.question, - this.image, - this.audio, - required final List options, - required this.correctAnswer, - required this.word, - this.type = 'multipleChoice'}) - : _options = options; - factory _$MultipleChoiceQuestionImpl.fromJson(Map json) => - _$$MultipleChoiceQuestionImplFromJson(json); +class _MultipleChoiceQuestion implements MultipleChoiceQuestion { + const _MultipleChoiceQuestion({required this.id, required this.question, this.image, this.audio, required final List options, required this.correctAnswer, required this.word, this.type = 'multipleChoice'}): _options = options; + factory _MultipleChoiceQuestion.fromJson(Map json) => _$MultipleChoiceQuestionFromJson(json); - @override - final String id; - @override - final String question; - @override - final String? image; - @override - final String? audio; - final List _options; - @override - List get options { - if (_options is EqualUnmodifiableListView) return _options; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_options); - } +@override final String id; +@override final String question; +@override final String? image; +@override final String? audio; + final List _options; +@override List get options { + if (_options is EqualUnmodifiableListView) return _options; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_options); +} - @override - final String correctAnswer; - @override - final String word; +@override final String correctAnswer; +@override final String word; // associated word for statistics - @override - @JsonKey() - final String type; +@override@JsonKey() final String type; - @override - String toString() { - return 'MultipleChoiceQuestion(id: $id, question: $question, image: $image, audio: $audio, options: $options, correctAnswer: $correctAnswer, word: $word, type: $type)'; - } +/// Create a copy of MultipleChoiceQuestion +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$MultipleChoiceQuestionCopyWith<_MultipleChoiceQuestion> get copyWith => __$MultipleChoiceQuestionCopyWithImpl<_MultipleChoiceQuestion>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$MultipleChoiceQuestionImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.question, question) || - other.question == question) && - (identical(other.image, image) || other.image == image) && - (identical(other.audio, audio) || other.audio == audio) && - const DeepCollectionEquality().equals(other._options, _options) && - (identical(other.correctAnswer, correctAnswer) || - other.correctAnswer == correctAnswer) && - (identical(other.word, word) || other.word == word) && - (identical(other.type, type) || other.type == type)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash(runtimeType, id, question, image, audio, - const DeepCollectionEquality().hash(_options), correctAnswer, word, type); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$MultipleChoiceQuestionImplCopyWith<_$MultipleChoiceQuestionImpl> - get copyWith => __$$MultipleChoiceQuestionImplCopyWithImpl< - _$MultipleChoiceQuestionImpl>(this, _$identity); - - @override - Map toJson() { - return _$$MultipleChoiceQuestionImplToJson( - this, - ); - } +@override +Map toJson() { + return _$MultipleChoiceQuestionToJson(this, ); } -abstract class _MultipleChoiceQuestion implements MultipleChoiceQuestion { - const factory _MultipleChoiceQuestion( - {required final String id, - required final String question, - final String? image, - final String? audio, - required final List options, - required final String correctAnswer, - required final String word, - final String type}) = _$MultipleChoiceQuestionImpl; - - factory _MultipleChoiceQuestion.fromJson(Map json) = - _$MultipleChoiceQuestionImpl.fromJson; - - @override - String get id; - @override - String get question; - @override - String? get image; - @override - String? get audio; - @override - List get options; - @override - String get correctAnswer; - @override - String get word; - @override // associated word for statistics - String get type; - @override - @JsonKey(ignore: true) - _$$MultipleChoiceQuestionImplCopyWith<_$MultipleChoiceQuestionImpl> - get copyWith => throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _MultipleChoiceQuestion&&(identical(other.id, id) || other.id == id)&&(identical(other.question, question) || other.question == question)&&(identical(other.image, image) || other.image == image)&&(identical(other.audio, audio) || other.audio == audio)&&const DeepCollectionEquality().equals(other._options, _options)&&(identical(other.correctAnswer, correctAnswer) || other.correctAnswer == correctAnswer)&&(identical(other.word, word) || other.word == word)&&(identical(other.type, type) || other.type == type)); } -InputLettersQuestion _$InputLettersQuestionFromJson(Map json) { - return _InputLettersQuestion.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,question,image,audio,const DeepCollectionEquality().hash(_options),correctAnswer,word,type); + +@override +String toString() { + return 'MultipleChoiceQuestion(id: $id, question: $question, image: $image, audio: $audio, options: $options, correctAnswer: $correctAnswer, word: $word, type: $type)'; } + +} + +/// @nodoc +abstract mixin class _$MultipleChoiceQuestionCopyWith<$Res> implements $MultipleChoiceQuestionCopyWith<$Res> { + factory _$MultipleChoiceQuestionCopyWith(_MultipleChoiceQuestion value, $Res Function(_MultipleChoiceQuestion) _then) = __$MultipleChoiceQuestionCopyWithImpl; +@override @useResult +$Res call({ + String id, String question, String? image, String? audio, List options, String correctAnswer, String word, String type +}); + + + + +} +/// @nodoc +class __$MultipleChoiceQuestionCopyWithImpl<$Res> + implements _$MultipleChoiceQuestionCopyWith<$Res> { + __$MultipleChoiceQuestionCopyWithImpl(this._self, this._then); + + final _MultipleChoiceQuestion _self; + final $Res Function(_MultipleChoiceQuestion) _then; + +/// Create a copy of MultipleChoiceQuestion +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? question = null,Object? image = freezed,Object? audio = freezed,Object? options = null,Object? correctAnswer = null,Object? word = null,Object? type = null,}) { + return _then(_MultipleChoiceQuestion( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,question: null == question ? _self.question : question // ignore: cast_nullable_to_non_nullable +as String,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?,audio: freezed == audio ? _self.audio : audio // ignore: cast_nullable_to_non_nullable +as String?,options: null == options ? _self._options : options // ignore: cast_nullable_to_non_nullable +as List,correctAnswer: null == correctAnswer ? _self.correctAnswer : correctAnswer // ignore: cast_nullable_to_non_nullable +as String,word: null == word ? _self.word : word // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + + /// @nodoc mixin _$InputLettersQuestion { - String get id => throw _privateConstructorUsedError; - String get template => - throw _privateConstructorUsedError; // e.g., "H _ _ L _" - String? get image => throw _privateConstructorUsedError; - String? get audio => throw _privateConstructorUsedError; - String get correctAnswer => throw _privateConstructorUsedError; - String get word => throw _privateConstructorUsedError; - String get type => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $InputLettersQuestionCopyWith get copyWith => - throw _privateConstructorUsedError; + String get id; String get template;// e.g., "H _ _ L _" + String? get image; String? get audio; String get correctAnswer; String get word; String get type; +/// Create a copy of InputLettersQuestion +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$InputLettersQuestionCopyWith get copyWith => _$InputLettersQuestionCopyWithImpl(this as InputLettersQuestion, _$identity); + + /// Serializes this InputLettersQuestion to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is InputLettersQuestion&&(identical(other.id, id) || other.id == id)&&(identical(other.template, template) || other.template == template)&&(identical(other.image, image) || other.image == image)&&(identical(other.audio, audio) || other.audio == audio)&&(identical(other.correctAnswer, correctAnswer) || other.correctAnswer == correctAnswer)&&(identical(other.word, word) || other.word == word)&&(identical(other.type, type) || other.type == type)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,template,image,audio,correctAnswer,word,type); + +@override +String toString() { + return 'InputLettersQuestion(id: $id, template: $template, image: $image, audio: $audio, correctAnswer: $correctAnswer, word: $word, type: $type)'; +} + + } /// @nodoc -abstract class $InputLettersQuestionCopyWith<$Res> { - factory $InputLettersQuestionCopyWith(InputLettersQuestion value, - $Res Function(InputLettersQuestion) then) = - _$InputLettersQuestionCopyWithImpl<$Res, InputLettersQuestion>; - @useResult - $Res call( - {String id, - String template, - String? image, - String? audio, - String correctAnswer, - String word, - String type}); -} +abstract mixin class $InputLettersQuestionCopyWith<$Res> { + factory $InputLettersQuestionCopyWith(InputLettersQuestion value, $Res Function(InputLettersQuestion) _then) = _$InputLettersQuestionCopyWithImpl; +@useResult +$Res call({ + String id, String template, String? image, String? audio, String correctAnswer, String word, String type +}); + + + +} /// @nodoc -class _$InputLettersQuestionCopyWithImpl<$Res, - $Val extends InputLettersQuestion> +class _$InputLettersQuestionCopyWithImpl<$Res> implements $InputLettersQuestionCopyWith<$Res> { - _$InputLettersQuestionCopyWithImpl(this._value, this._then); + _$InputLettersQuestionCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final InputLettersQuestion _self; + final $Res Function(InputLettersQuestion) _then; - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? template = null, - Object? image = freezed, - Object? audio = freezed, - Object? correctAnswer = null, - Object? word = null, - Object? type = null, - }) { - return _then(_value.copyWith( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - template: null == template - ? _value.template - : template // ignore: cast_nullable_to_non_nullable - as String, - image: freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - audio: freezed == audio - ? _value.audio - : audio // ignore: cast_nullable_to_non_nullable - as String?, - correctAnswer: null == correctAnswer - ? _value.correctAnswer - : correctAnswer // ignore: cast_nullable_to_non_nullable - as String, - word: null == word - ? _value.word - : word // ignore: cast_nullable_to_non_nullable - as String, - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String, - ) as $Val); - } +/// Create a copy of InputLettersQuestion +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? template = null,Object? image = freezed,Object? audio = freezed,Object? correctAnswer = null,Object? word = null,Object? type = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,template: null == template ? _self.template : template // ignore: cast_nullable_to_non_nullable +as String,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?,audio: freezed == audio ? _self.audio : audio // ignore: cast_nullable_to_non_nullable +as String?,correctAnswer: null == correctAnswer ? _self.correctAnswer : correctAnswer // ignore: cast_nullable_to_non_nullable +as String,word: null == word ? _self.word : word // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -abstract class _$$InputLettersQuestionImplCopyWith<$Res> - implements $InputLettersQuestionCopyWith<$Res> { - factory _$$InputLettersQuestionImplCopyWith(_$InputLettersQuestionImpl value, - $Res Function(_$InputLettersQuestionImpl) then) = - __$$InputLettersQuestionImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String id, - String template, - String? image, - String? audio, - String correctAnswer, - String word, - String type}); } -/// @nodoc -class __$$InputLettersQuestionImplCopyWithImpl<$Res> - extends _$InputLettersQuestionCopyWithImpl<$Res, _$InputLettersQuestionImpl> - implements _$$InputLettersQuestionImplCopyWith<$Res> { - __$$InputLettersQuestionImplCopyWithImpl(_$InputLettersQuestionImpl _value, - $Res Function(_$InputLettersQuestionImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? template = null, - Object? image = freezed, - Object? audio = freezed, - Object? correctAnswer = null, - Object? word = null, - Object? type = null, - }) { - return _then(_$InputLettersQuestionImpl( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - template: null == template - ? _value.template - : template // ignore: cast_nullable_to_non_nullable - as String, - image: freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - audio: freezed == audio - ? _value.audio - : audio // ignore: cast_nullable_to_non_nullable - as String?, - correctAnswer: null == correctAnswer - ? _value.correctAnswer - : correctAnswer // ignore: cast_nullable_to_non_nullable - as String, - word: null == word - ? _value.word - : word // ignore: cast_nullable_to_non_nullable - as String, - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String, - )); - } +/// Adds pattern-matching-related methods to [InputLettersQuestion]. +extension InputLettersQuestionPatterns on InputLettersQuestion { +/// 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 Function( _InputLettersQuestion value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _InputLettersQuestion() 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 Function( _InputLettersQuestion value) $default,){ +final _that = this; +switch (_that) { +case _InputLettersQuestion(): +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? Function( _InputLettersQuestion value)? $default,){ +final _that = this; +switch (_that) { +case _InputLettersQuestion() 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 Function( String id, String template, String? image, String? audio, String correctAnswer, String word, String type)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _InputLettersQuestion() when $default != null: +return $default(_that.id,_that.template,_that.image,_that.audio,_that.correctAnswer,_that.word,_that.type);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 Function( String id, String template, String? image, String? audio, String correctAnswer, String word, String type) $default,) {final _that = this; +switch (_that) { +case _InputLettersQuestion(): +return $default(_that.id,_that.template,_that.image,_that.audio,_that.correctAnswer,_that.word,_that.type);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? Function( String id, String template, String? image, String? audio, String correctAnswer, String word, String type)? $default,) {final _that = this; +switch (_that) { +case _InputLettersQuestion() when $default != null: +return $default(_that.id,_that.template,_that.image,_that.audio,_that.correctAnswer,_that.word,_that.type);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$InputLettersQuestionImpl implements _InputLettersQuestion { - const _$InputLettersQuestionImpl( - {required this.id, - required this.template, - this.image, - this.audio, - required this.correctAnswer, - required this.word, - this.type = 'inputLetters'}); - factory _$InputLettersQuestionImpl.fromJson(Map json) => - _$$InputLettersQuestionImplFromJson(json); +class _InputLettersQuestion implements InputLettersQuestion { + const _InputLettersQuestion({required this.id, required this.template, this.image, this.audio, required this.correctAnswer, required this.word, this.type = 'inputLetters'}); + factory _InputLettersQuestion.fromJson(Map json) => _$InputLettersQuestionFromJson(json); - @override - final String id; - @override - final String template; +@override final String id; +@override final String template; // e.g., "H _ _ L _" - @override - final String? image; - @override - final String? audio; - @override - final String correctAnswer; - @override - final String word; - @override - @JsonKey() - final String type; +@override final String? image; +@override final String? audio; +@override final String correctAnswer; +@override final String word; +@override@JsonKey() final String type; - @override - String toString() { - return 'InputLettersQuestion(id: $id, template: $template, image: $image, audio: $audio, correctAnswer: $correctAnswer, word: $word, type: $type)'; - } +/// Create a copy of InputLettersQuestion +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$InputLettersQuestionCopyWith<_InputLettersQuestion> get copyWith => __$InputLettersQuestionCopyWithImpl<_InputLettersQuestion>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$InputLettersQuestionImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.template, template) || - other.template == template) && - (identical(other.image, image) || other.image == image) && - (identical(other.audio, audio) || other.audio == audio) && - (identical(other.correctAnswer, correctAnswer) || - other.correctAnswer == correctAnswer) && - (identical(other.word, word) || other.word == word) && - (identical(other.type, type) || other.type == type)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash( - runtimeType, id, template, image, audio, correctAnswer, word, type); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$InputLettersQuestionImplCopyWith<_$InputLettersQuestionImpl> - get copyWith => - __$$InputLettersQuestionImplCopyWithImpl<_$InputLettersQuestionImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$InputLettersQuestionImplToJson( - this, - ); - } +@override +Map toJson() { + return _$InputLettersQuestionToJson(this, ); } -abstract class _InputLettersQuestion implements InputLettersQuestion { - const factory _InputLettersQuestion( - {required final String id, - required final String template, - final String? image, - final String? audio, - required final String correctAnswer, - required final String word, - final String type}) = _$InputLettersQuestionImpl; - - factory _InputLettersQuestion.fromJson(Map json) = - _$InputLettersQuestionImpl.fromJson; - - @override - String get id; - @override - String get template; - @override // e.g., "H _ _ L _" - String? get image; - @override - String? get audio; - @override - String get correctAnswer; - @override - String get word; - @override - String get type; - @override - @JsonKey(ignore: true) - _$$InputLettersQuestionImplCopyWith<_$InputLettersQuestionImpl> - get copyWith => throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _InputLettersQuestion&&(identical(other.id, id) || other.id == id)&&(identical(other.template, template) || other.template == template)&&(identical(other.image, image) || other.image == image)&&(identical(other.audio, audio) || other.audio == audio)&&(identical(other.correctAnswer, correctAnswer) || other.correctAnswer == correctAnswer)&&(identical(other.word, word) || other.word == word)&&(identical(other.type, type) || other.type == type)); } -MatchQuestion _$MatchQuestionFromJson(Map json) { - return _MatchQuestion.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,template,image,audio,correctAnswer,word,type); + +@override +String toString() { + return 'InputLettersQuestion(id: $id, template: $template, image: $image, audio: $audio, correctAnswer: $correctAnswer, word: $word, type: $type)'; } + +} + +/// @nodoc +abstract mixin class _$InputLettersQuestionCopyWith<$Res> implements $InputLettersQuestionCopyWith<$Res> { + factory _$InputLettersQuestionCopyWith(_InputLettersQuestion value, $Res Function(_InputLettersQuestion) _then) = __$InputLettersQuestionCopyWithImpl; +@override @useResult +$Res call({ + String id, String template, String? image, String? audio, String correctAnswer, String word, String type +}); + + + + +} +/// @nodoc +class __$InputLettersQuestionCopyWithImpl<$Res> + implements _$InputLettersQuestionCopyWith<$Res> { + __$InputLettersQuestionCopyWithImpl(this._self, this._then); + + final _InputLettersQuestion _self; + final $Res Function(_InputLettersQuestion) _then; + +/// Create a copy of InputLettersQuestion +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? template = null,Object? image = freezed,Object? audio = freezed,Object? correctAnswer = null,Object? word = null,Object? type = null,}) { + return _then(_InputLettersQuestion( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,template: null == template ? _self.template : template // ignore: cast_nullable_to_non_nullable +as String,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?,audio: freezed == audio ? _self.audio : audio // ignore: cast_nullable_to_non_nullable +as String?,correctAnswer: null == correctAnswer ? _self.correctAnswer : correctAnswer // ignore: cast_nullable_to_non_nullable +as String,word: null == word ? _self.word : word // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + + /// @nodoc mixin _$MatchQuestion { - String get id => throw _privateConstructorUsedError; - String get question => throw _privateConstructorUsedError; - String? get image => throw _privateConstructorUsedError; - String? get audio => throw _privateConstructorUsedError; - List get leftItems => throw _privateConstructorUsedError; - List get rightItems => throw _privateConstructorUsedError; - List get correctPairs => throw _privateConstructorUsedError; - String get word => throw _privateConstructorUsedError; - String get type => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $MatchQuestionCopyWith get copyWith => - throw _privateConstructorUsedError; + String get id; String get question; String? get image; String? get audio; List get leftItems; List get rightItems; List get correctPairs; String get word; String get type; +/// Create a copy of MatchQuestion +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$MatchQuestionCopyWith get copyWith => _$MatchQuestionCopyWithImpl(this as MatchQuestion, _$identity); + + /// Serializes this MatchQuestion to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is MatchQuestion&&(identical(other.id, id) || other.id == id)&&(identical(other.question, question) || other.question == question)&&(identical(other.image, image) || other.image == image)&&(identical(other.audio, audio) || other.audio == audio)&&const DeepCollectionEquality().equals(other.leftItems, leftItems)&&const DeepCollectionEquality().equals(other.rightItems, rightItems)&&const DeepCollectionEquality().equals(other.correctPairs, correctPairs)&&(identical(other.word, word) || other.word == word)&&(identical(other.type, type) || other.type == type)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,question,image,audio,const DeepCollectionEquality().hash(leftItems),const DeepCollectionEquality().hash(rightItems),const DeepCollectionEquality().hash(correctPairs),word,type); + +@override +String toString() { + return 'MatchQuestion(id: $id, question: $question, image: $image, audio: $audio, leftItems: $leftItems, rightItems: $rightItems, correctPairs: $correctPairs, word: $word, type: $type)'; +} + + } /// @nodoc -abstract class $MatchQuestionCopyWith<$Res> { - factory $MatchQuestionCopyWith( - MatchQuestion value, $Res Function(MatchQuestion) then) = - _$MatchQuestionCopyWithImpl<$Res, MatchQuestion>; - @useResult - $Res call( - {String id, - String question, - String? image, - String? audio, - List leftItems, - List rightItems, - List correctPairs, - String word, - String type}); -} +abstract mixin class $MatchQuestionCopyWith<$Res> { + factory $MatchQuestionCopyWith(MatchQuestion value, $Res Function(MatchQuestion) _then) = _$MatchQuestionCopyWithImpl; +@useResult +$Res call({ + String id, String question, String? image, String? audio, List leftItems, List rightItems, List correctPairs, String word, String type +}); + + + +} /// @nodoc -class _$MatchQuestionCopyWithImpl<$Res, $Val extends MatchQuestion> +class _$MatchQuestionCopyWithImpl<$Res> implements $MatchQuestionCopyWith<$Res> { - _$MatchQuestionCopyWithImpl(this._value, this._then); + _$MatchQuestionCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final MatchQuestion _self; + final $Res Function(MatchQuestion) _then; - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? question = null, - Object? image = freezed, - Object? audio = freezed, - Object? leftItems = null, - Object? rightItems = null, - Object? correctPairs = null, - Object? word = null, - Object? type = null, - }) { - return _then(_value.copyWith( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - question: null == question - ? _value.question - : question // ignore: cast_nullable_to_non_nullable - as String, - image: freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - audio: freezed == audio - ? _value.audio - : audio // ignore: cast_nullable_to_non_nullable - as String?, - leftItems: null == leftItems - ? _value.leftItems - : leftItems // ignore: cast_nullable_to_non_nullable - as List, - rightItems: null == rightItems - ? _value.rightItems - : rightItems // ignore: cast_nullable_to_non_nullable - as List, - correctPairs: null == correctPairs - ? _value.correctPairs - : correctPairs // ignore: cast_nullable_to_non_nullable - as List, - word: null == word - ? _value.word - : word // ignore: cast_nullable_to_non_nullable - as String, - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String, - ) as $Val); - } +/// Create a copy of MatchQuestion +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? question = null,Object? image = freezed,Object? audio = freezed,Object? leftItems = null,Object? rightItems = null,Object? correctPairs = null,Object? word = null,Object? type = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,question: null == question ? _self.question : question // ignore: cast_nullable_to_non_nullable +as String,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?,audio: freezed == audio ? _self.audio : audio // ignore: cast_nullable_to_non_nullable +as String?,leftItems: null == leftItems ? _self.leftItems : leftItems // ignore: cast_nullable_to_non_nullable +as List,rightItems: null == rightItems ? _self.rightItems : rightItems // ignore: cast_nullable_to_non_nullable +as List,correctPairs: null == correctPairs ? _self.correctPairs : correctPairs // ignore: cast_nullable_to_non_nullable +as List,word: null == word ? _self.word : word // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -abstract class _$$MatchQuestionImplCopyWith<$Res> - implements $MatchQuestionCopyWith<$Res> { - factory _$$MatchQuestionImplCopyWith( - _$MatchQuestionImpl value, $Res Function(_$MatchQuestionImpl) then) = - __$$MatchQuestionImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String id, - String question, - String? image, - String? audio, - List leftItems, - List rightItems, - List correctPairs, - String word, - String type}); } -/// @nodoc -class __$$MatchQuestionImplCopyWithImpl<$Res> - extends _$MatchQuestionCopyWithImpl<$Res, _$MatchQuestionImpl> - implements _$$MatchQuestionImplCopyWith<$Res> { - __$$MatchQuestionImplCopyWithImpl( - _$MatchQuestionImpl _value, $Res Function(_$MatchQuestionImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? question = null, - Object? image = freezed, - Object? audio = freezed, - Object? leftItems = null, - Object? rightItems = null, - Object? correctPairs = null, - Object? word = null, - Object? type = null, - }) { - return _then(_$MatchQuestionImpl( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - question: null == question - ? _value.question - : question // ignore: cast_nullable_to_non_nullable - as String, - image: freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - audio: freezed == audio - ? _value.audio - : audio // ignore: cast_nullable_to_non_nullable - as String?, - leftItems: null == leftItems - ? _value._leftItems - : leftItems // ignore: cast_nullable_to_non_nullable - as List, - rightItems: null == rightItems - ? _value._rightItems - : rightItems // ignore: cast_nullable_to_non_nullable - as List, - correctPairs: null == correctPairs - ? _value._correctPairs - : correctPairs // ignore: cast_nullable_to_non_nullable - as List, - word: null == word - ? _value.word - : word // ignore: cast_nullable_to_non_nullable - as String, - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String, - )); - } +/// Adds pattern-matching-related methods to [MatchQuestion]. +extension MatchQuestionPatterns on MatchQuestion { +/// 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 Function( _MatchQuestion value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _MatchQuestion() 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 Function( _MatchQuestion value) $default,){ +final _that = this; +switch (_that) { +case _MatchQuestion(): +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? Function( _MatchQuestion value)? $default,){ +final _that = this; +switch (_that) { +case _MatchQuestion() 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 Function( String id, String question, String? image, String? audio, List leftItems, List rightItems, List correctPairs, String word, String type)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _MatchQuestion() when $default != null: +return $default(_that.id,_that.question,_that.image,_that.audio,_that.leftItems,_that.rightItems,_that.correctPairs,_that.word,_that.type);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 Function( String id, String question, String? image, String? audio, List leftItems, List rightItems, List correctPairs, String word, String type) $default,) {final _that = this; +switch (_that) { +case _MatchQuestion(): +return $default(_that.id,_that.question,_that.image,_that.audio,_that.leftItems,_that.rightItems,_that.correctPairs,_that.word,_that.type);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? Function( String id, String question, String? image, String? audio, List leftItems, List rightItems, List correctPairs, String word, String type)? $default,) {final _that = this; +switch (_that) { +case _MatchQuestion() when $default != null: +return $default(_that.id,_that.question,_that.image,_that.audio,_that.leftItems,_that.rightItems,_that.correctPairs,_that.word,_that.type);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$MatchQuestionImpl implements _MatchQuestion { - const _$MatchQuestionImpl( - {required this.id, - required this.question, - this.image, - this.audio, - required final List leftItems, - required final List rightItems, - required final List correctPairs, - required this.word, - this.type = 'match'}) - : _leftItems = leftItems, - _rightItems = rightItems, - _correctPairs = correctPairs; - factory _$MatchQuestionImpl.fromJson(Map json) => - _$$MatchQuestionImplFromJson(json); +class _MatchQuestion implements MatchQuestion { + const _MatchQuestion({required this.id, required this.question, this.image, this.audio, required final List leftItems, required final List rightItems, required final List correctPairs, required this.word, this.type = 'match'}): _leftItems = leftItems,_rightItems = rightItems,_correctPairs = correctPairs; + factory _MatchQuestion.fromJson(Map json) => _$MatchQuestionFromJson(json); - @override - final String id; - @override - final String question; - @override - final String? image; - @override - final String? audio; - final List _leftItems; - @override - List get leftItems { - if (_leftItems is EqualUnmodifiableListView) return _leftItems; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_leftItems); - } - - final List _rightItems; - @override - List get rightItems { - if (_rightItems is EqualUnmodifiableListView) return _rightItems; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_rightItems); - } - - final List _correctPairs; - @override - List get correctPairs { - if (_correctPairs is EqualUnmodifiableListView) return _correctPairs; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_correctPairs); - } - - @override - final String word; - @override - @JsonKey() - final String type; - - @override - String toString() { - return 'MatchQuestion(id: $id, question: $question, image: $image, audio: $audio, leftItems: $leftItems, rightItems: $rightItems, correctPairs: $correctPairs, word: $word, type: $type)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$MatchQuestionImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.question, question) || - other.question == question) && - (identical(other.image, image) || other.image == image) && - (identical(other.audio, audio) || other.audio == audio) && - const DeepCollectionEquality() - .equals(other._leftItems, _leftItems) && - const DeepCollectionEquality() - .equals(other._rightItems, _rightItems) && - const DeepCollectionEquality() - .equals(other._correctPairs, _correctPairs) && - (identical(other.word, word) || other.word == word) && - (identical(other.type, type) || other.type == type)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash( - runtimeType, - id, - question, - image, - audio, - const DeepCollectionEquality().hash(_leftItems), - const DeepCollectionEquality().hash(_rightItems), - const DeepCollectionEquality().hash(_correctPairs), - word, - type); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$MatchQuestionImplCopyWith<_$MatchQuestionImpl> get copyWith => - __$$MatchQuestionImplCopyWithImpl<_$MatchQuestionImpl>(this, _$identity); - - @override - Map toJson() { - return _$$MatchQuestionImplToJson( - this, - ); - } +@override final String id; +@override final String question; +@override final String? image; +@override final String? audio; + final List _leftItems; +@override List get leftItems { + if (_leftItems is EqualUnmodifiableListView) return _leftItems; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_leftItems); } -abstract class _MatchQuestion implements MatchQuestion { - const factory _MatchQuestion( - {required final String id, - required final String question, - final String? image, - final String? audio, - required final List leftItems, - required final List rightItems, - required final List correctPairs, - required final String word, - final String type}) = _$MatchQuestionImpl; - - factory _MatchQuestion.fromJson(Map json) = - _$MatchQuestionImpl.fromJson; - - @override - String get id; - @override - String get question; - @override - String? get image; - @override - String? get audio; - @override - List get leftItems; - @override - List get rightItems; - @override - List get correctPairs; - @override - String get word; - @override - String get type; - @override - @JsonKey(ignore: true) - _$$MatchQuestionImplCopyWith<_$MatchQuestionImpl> get copyWith => - throw _privateConstructorUsedError; + final List _rightItems; +@override List get rightItems { + if (_rightItems is EqualUnmodifiableListView) return _rightItems; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_rightItems); } -MatchItem _$MatchItemFromJson(Map json) { - return _MatchItem.fromJson(json); + final List _correctPairs; +@override List get correctPairs { + if (_correctPairs is EqualUnmodifiableListView) return _correctPairs; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_correctPairs); } +@override final String word; +@override@JsonKey() final String type; + +/// Create a copy of MatchQuestion +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$MatchQuestionCopyWith<_MatchQuestion> get copyWith => __$MatchQuestionCopyWithImpl<_MatchQuestion>(this, _$identity); + +@override +Map toJson() { + return _$MatchQuestionToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _MatchQuestion&&(identical(other.id, id) || other.id == id)&&(identical(other.question, question) || other.question == question)&&(identical(other.image, image) || other.image == image)&&(identical(other.audio, audio) || other.audio == audio)&&const DeepCollectionEquality().equals(other._leftItems, _leftItems)&&const DeepCollectionEquality().equals(other._rightItems, _rightItems)&&const DeepCollectionEquality().equals(other._correctPairs, _correctPairs)&&(identical(other.word, word) || other.word == word)&&(identical(other.type, type) || other.type == type)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,question,image,audio,const DeepCollectionEquality().hash(_leftItems),const DeepCollectionEquality().hash(_rightItems),const DeepCollectionEquality().hash(_correctPairs),word,type); + +@override +String toString() { + return 'MatchQuestion(id: $id, question: $question, image: $image, audio: $audio, leftItems: $leftItems, rightItems: $rightItems, correctPairs: $correctPairs, word: $word, type: $type)'; +} + + +} + +/// @nodoc +abstract mixin class _$MatchQuestionCopyWith<$Res> implements $MatchQuestionCopyWith<$Res> { + factory _$MatchQuestionCopyWith(_MatchQuestion value, $Res Function(_MatchQuestion) _then) = __$MatchQuestionCopyWithImpl; +@override @useResult +$Res call({ + String id, String question, String? image, String? audio, List leftItems, List rightItems, List correctPairs, String word, String type +}); + + + + +} +/// @nodoc +class __$MatchQuestionCopyWithImpl<$Res> + implements _$MatchQuestionCopyWith<$Res> { + __$MatchQuestionCopyWithImpl(this._self, this._then); + + final _MatchQuestion _self; + final $Res Function(_MatchQuestion) _then; + +/// Create a copy of MatchQuestion +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? question = null,Object? image = freezed,Object? audio = freezed,Object? leftItems = null,Object? rightItems = null,Object? correctPairs = null,Object? word = null,Object? type = null,}) { + return _then(_MatchQuestion( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,question: null == question ? _self.question : question // ignore: cast_nullable_to_non_nullable +as String,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?,audio: freezed == audio ? _self.audio : audio // ignore: cast_nullable_to_non_nullable +as String?,leftItems: null == leftItems ? _self._leftItems : leftItems // ignore: cast_nullable_to_non_nullable +as List,rightItems: null == rightItems ? _self._rightItems : rightItems // ignore: cast_nullable_to_non_nullable +as List,correctPairs: null == correctPairs ? _self._correctPairs : correctPairs // ignore: cast_nullable_to_non_nullable +as List,word: null == word ? _self.word : word // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + + /// @nodoc mixin _$MatchItem { - String get id => throw _privateConstructorUsedError; - String get text => throw _privateConstructorUsedError; - String? get image => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $MatchItemCopyWith get copyWith => - throw _privateConstructorUsedError; + String get id; String get text; String? get image; +/// Create a copy of MatchItem +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$MatchItemCopyWith get copyWith => _$MatchItemCopyWithImpl(this as MatchItem, _$identity); + + /// Serializes this MatchItem to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is MatchItem&&(identical(other.id, id) || other.id == id)&&(identical(other.text, text) || other.text == text)&&(identical(other.image, image) || other.image == image)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,text,image); + +@override +String toString() { + return 'MatchItem(id: $id, text: $text, image: $image)'; +} + + } /// @nodoc -abstract class $MatchItemCopyWith<$Res> { - factory $MatchItemCopyWith(MatchItem value, $Res Function(MatchItem) then) = - _$MatchItemCopyWithImpl<$Res, MatchItem>; - @useResult - $Res call({String id, String text, String? image}); -} +abstract mixin class $MatchItemCopyWith<$Res> { + factory $MatchItemCopyWith(MatchItem value, $Res Function(MatchItem) _then) = _$MatchItemCopyWithImpl; +@useResult +$Res call({ + String id, String text, String? image +}); + + + +} /// @nodoc -class _$MatchItemCopyWithImpl<$Res, $Val extends MatchItem> +class _$MatchItemCopyWithImpl<$Res> implements $MatchItemCopyWith<$Res> { - _$MatchItemCopyWithImpl(this._value, this._then); + _$MatchItemCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final MatchItem _self; + final $Res Function(MatchItem) _then; - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? text = null, - Object? image = freezed, - }) { - return _then(_value.copyWith( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - text: null == text - ? _value.text - : text // ignore: cast_nullable_to_non_nullable - as String, - image: freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } +/// Create a copy of MatchItem +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? text = null,Object? image = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,text: null == text ? _self.text : text // ignore: cast_nullable_to_non_nullable +as String,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?, + )); } -/// @nodoc -abstract class _$$MatchItemImplCopyWith<$Res> - implements $MatchItemCopyWith<$Res> { - factory _$$MatchItemImplCopyWith( - _$MatchItemImpl value, $Res Function(_$MatchItemImpl) then) = - __$$MatchItemImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String id, String text, String? image}); } -/// @nodoc -class __$$MatchItemImplCopyWithImpl<$Res> - extends _$MatchItemCopyWithImpl<$Res, _$MatchItemImpl> - implements _$$MatchItemImplCopyWith<$Res> { - __$$MatchItemImplCopyWithImpl( - _$MatchItemImpl _value, $Res Function(_$MatchItemImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? text = null, - Object? image = freezed, - }) { - return _then(_$MatchItemImpl( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - text: null == text - ? _value.text - : text // ignore: cast_nullable_to_non_nullable - as String, - image: freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - )); - } +/// Adds pattern-matching-related methods to [MatchItem]. +extension MatchItemPatterns on MatchItem { +/// 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 Function( _MatchItem value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _MatchItem() 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 Function( _MatchItem value) $default,){ +final _that = this; +switch (_that) { +case _MatchItem(): +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? Function( _MatchItem value)? $default,){ +final _that = this; +switch (_that) { +case _MatchItem() 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 Function( String id, String text, String? image)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _MatchItem() when $default != null: +return $default(_that.id,_that.text,_that.image);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 Function( String id, String text, String? image) $default,) {final _that = this; +switch (_that) { +case _MatchItem(): +return $default(_that.id,_that.text,_that.image);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? Function( String id, String text, String? image)? $default,) {final _that = this; +switch (_that) { +case _MatchItem() when $default != null: +return $default(_that.id,_that.text,_that.image);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$MatchItemImpl implements _MatchItem { - const _$MatchItemImpl({required this.id, required this.text, this.image}); - factory _$MatchItemImpl.fromJson(Map json) => - _$$MatchItemImplFromJson(json); +class _MatchItem implements MatchItem { + const _MatchItem({required this.id, required this.text, this.image}); + factory _MatchItem.fromJson(Map json) => _$MatchItemFromJson(json); - @override - final String id; - @override - final String text; - @override - final String? image; +@override final String id; +@override final String text; +@override final String? image; - @override - String toString() { - return 'MatchItem(id: $id, text: $text, image: $image)'; - } +/// Create a copy of MatchItem +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$MatchItemCopyWith<_MatchItem> get copyWith => __$MatchItemCopyWithImpl<_MatchItem>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$MatchItemImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.text, text) || other.text == text) && - (identical(other.image, image) || other.image == image)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash(runtimeType, id, text, image); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$MatchItemImplCopyWith<_$MatchItemImpl> get copyWith => - __$$MatchItemImplCopyWithImpl<_$MatchItemImpl>(this, _$identity); - - @override - Map toJson() { - return _$$MatchItemImplToJson( - this, - ); - } +@override +Map toJson() { + return _$MatchItemToJson(this, ); } -abstract class _MatchItem implements MatchItem { - const factory _MatchItem( - {required final String id, - required final String text, - final String? image}) = _$MatchItemImpl; - - factory _MatchItem.fromJson(Map json) = - _$MatchItemImpl.fromJson; - - @override - String get id; - @override - String get text; - @override - String? get image; - @override - @JsonKey(ignore: true) - _$$MatchItemImplCopyWith<_$MatchItemImpl> get copyWith => - throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _MatchItem&&(identical(other.id, id) || other.id == id)&&(identical(other.text, text) || other.text == text)&&(identical(other.image, image) || other.image == image)); } -MatchPair _$MatchPairFromJson(Map json) { - return _MatchPair.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,text,image); + +@override +String toString() { + return 'MatchItem(id: $id, text: $text, image: $image)'; } + +} + +/// @nodoc +abstract mixin class _$MatchItemCopyWith<$Res> implements $MatchItemCopyWith<$Res> { + factory _$MatchItemCopyWith(_MatchItem value, $Res Function(_MatchItem) _then) = __$MatchItemCopyWithImpl; +@override @useResult +$Res call({ + String id, String text, String? image +}); + + + + +} +/// @nodoc +class __$MatchItemCopyWithImpl<$Res> + implements _$MatchItemCopyWith<$Res> { + __$MatchItemCopyWithImpl(this._self, this._then); + + final _MatchItem _self; + final $Res Function(_MatchItem) _then; + +/// Create a copy of MatchItem +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? text = null,Object? image = freezed,}) { + return _then(_MatchItem( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,text: null == text ? _self.text : text // ignore: cast_nullable_to_non_nullable +as String,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + + +} + + /// @nodoc mixin _$MatchPair { - String get leftId => throw _privateConstructorUsedError; - String get rightId => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $MatchPairCopyWith get copyWith => - throw _privateConstructorUsedError; + String get leftId; String get rightId; +/// Create a copy of MatchPair +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$MatchPairCopyWith get copyWith => _$MatchPairCopyWithImpl(this as MatchPair, _$identity); + + /// Serializes this MatchPair to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is MatchPair&&(identical(other.leftId, leftId) || other.leftId == leftId)&&(identical(other.rightId, rightId) || other.rightId == rightId)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,leftId,rightId); + +@override +String toString() { + return 'MatchPair(leftId: $leftId, rightId: $rightId)'; +} + + } /// @nodoc -abstract class $MatchPairCopyWith<$Res> { - factory $MatchPairCopyWith(MatchPair value, $Res Function(MatchPair) then) = - _$MatchPairCopyWithImpl<$Res, MatchPair>; - @useResult - $Res call({String leftId, String rightId}); -} +abstract mixin class $MatchPairCopyWith<$Res> { + factory $MatchPairCopyWith(MatchPair value, $Res Function(MatchPair) _then) = _$MatchPairCopyWithImpl; +@useResult +$Res call({ + String leftId, String rightId +}); + + + +} /// @nodoc -class _$MatchPairCopyWithImpl<$Res, $Val extends MatchPair> +class _$MatchPairCopyWithImpl<$Res> implements $MatchPairCopyWith<$Res> { - _$MatchPairCopyWithImpl(this._value, this._then); + _$MatchPairCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final MatchPair _self; + final $Res Function(MatchPair) _then; - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? leftId = null, - Object? rightId = null, - }) { - return _then(_value.copyWith( - leftId: null == leftId - ? _value.leftId - : leftId // ignore: cast_nullable_to_non_nullable - as String, - rightId: null == rightId - ? _value.rightId - : rightId // ignore: cast_nullable_to_non_nullable - as String, - ) as $Val); - } +/// Create a copy of MatchPair +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? leftId = null,Object? rightId = null,}) { + return _then(_self.copyWith( +leftId: null == leftId ? _self.leftId : leftId // ignore: cast_nullable_to_non_nullable +as String,rightId: null == rightId ? _self.rightId : rightId // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -abstract class _$$MatchPairImplCopyWith<$Res> - implements $MatchPairCopyWith<$Res> { - factory _$$MatchPairImplCopyWith( - _$MatchPairImpl value, $Res Function(_$MatchPairImpl) then) = - __$$MatchPairImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String leftId, String rightId}); } -/// @nodoc -class __$$MatchPairImplCopyWithImpl<$Res> - extends _$MatchPairCopyWithImpl<$Res, _$MatchPairImpl> - implements _$$MatchPairImplCopyWith<$Res> { - __$$MatchPairImplCopyWithImpl( - _$MatchPairImpl _value, $Res Function(_$MatchPairImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? leftId = null, - Object? rightId = null, - }) { - return _then(_$MatchPairImpl( - leftId: null == leftId - ? _value.leftId - : leftId // ignore: cast_nullable_to_non_nullable - as String, - rightId: null == rightId - ? _value.rightId - : rightId // ignore: cast_nullable_to_non_nullable - as String, - )); - } +/// Adds pattern-matching-related methods to [MatchPair]. +extension MatchPairPatterns on MatchPair { +/// 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 Function( _MatchPair value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _MatchPair() 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 Function( _MatchPair value) $default,){ +final _that = this; +switch (_that) { +case _MatchPair(): +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? Function( _MatchPair value)? $default,){ +final _that = this; +switch (_that) { +case _MatchPair() 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 Function( String leftId, String rightId)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _MatchPair() when $default != null: +return $default(_that.leftId,_that.rightId);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 Function( String leftId, String rightId) $default,) {final _that = this; +switch (_that) { +case _MatchPair(): +return $default(_that.leftId,_that.rightId);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? Function( String leftId, String rightId)? $default,) {final _that = this; +switch (_that) { +case _MatchPair() when $default != null: +return $default(_that.leftId,_that.rightId);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$MatchPairImpl implements _MatchPair { - const _$MatchPairImpl({required this.leftId, required this.rightId}); - factory _$MatchPairImpl.fromJson(Map json) => - _$$MatchPairImplFromJson(json); +class _MatchPair implements MatchPair { + const _MatchPair({required this.leftId, required this.rightId}); + factory _MatchPair.fromJson(Map json) => _$MatchPairFromJson(json); - @override - final String leftId; - @override - final String rightId; +@override final String leftId; +@override final String rightId; - @override - String toString() { - return 'MatchPair(leftId: $leftId, rightId: $rightId)'; - } +/// Create a copy of MatchPair +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$MatchPairCopyWith<_MatchPair> get copyWith => __$MatchPairCopyWithImpl<_MatchPair>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$MatchPairImpl && - (identical(other.leftId, leftId) || other.leftId == leftId) && - (identical(other.rightId, rightId) || other.rightId == rightId)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash(runtimeType, leftId, rightId); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$MatchPairImplCopyWith<_$MatchPairImpl> get copyWith => - __$$MatchPairImplCopyWithImpl<_$MatchPairImpl>(this, _$identity); - - @override - Map toJson() { - return _$$MatchPairImplToJson( - this, - ); - } +@override +Map toJson() { + return _$MatchPairToJson(this, ); } -abstract class _MatchPair implements MatchPair { - const factory _MatchPair( - {required final String leftId, - required final String rightId}) = _$MatchPairImpl; - - factory _MatchPair.fromJson(Map json) = - _$MatchPairImpl.fromJson; - - @override - String get leftId; - @override - String get rightId; - @override - @JsonKey(ignore: true) - _$$MatchPairImplCopyWith<_$MatchPairImpl> get copyWith => - throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _MatchPair&&(identical(other.leftId, leftId) || other.leftId == leftId)&&(identical(other.rightId, rightId) || other.rightId == rightId)); } -MatrixQuestion _$MatrixQuestionFromJson(Map json) { - return _MatrixQuestion.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,leftId,rightId); + +@override +String toString() { + return 'MatchPair(leftId: $leftId, rightId: $rightId)'; } + +} + +/// @nodoc +abstract mixin class _$MatchPairCopyWith<$Res> implements $MatchPairCopyWith<$Res> { + factory _$MatchPairCopyWith(_MatchPair value, $Res Function(_MatchPair) _then) = __$MatchPairCopyWithImpl; +@override @useResult +$Res call({ + String leftId, String rightId +}); + + + + +} +/// @nodoc +class __$MatchPairCopyWithImpl<$Res> + implements _$MatchPairCopyWith<$Res> { + __$MatchPairCopyWithImpl(this._self, this._then); + + final _MatchPair _self; + final $Res Function(_MatchPair) _then; + +/// Create a copy of MatchPair +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? leftId = null,Object? rightId = null,}) { + return _then(_MatchPair( +leftId: null == leftId ? _self.leftId : leftId // ignore: cast_nullable_to_non_nullable +as String,rightId: null == rightId ? _self.rightId : rightId // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + + /// @nodoc mixin _$MatrixQuestion { - String get id => throw _privateConstructorUsedError; - String get question => throw _privateConstructorUsedError; - String? get image => throw _privateConstructorUsedError; - String? get audio => throw _privateConstructorUsedError; - List get rowHeaders => throw _privateConstructorUsedError; - List get columnHeaders => throw _privateConstructorUsedError; - List get correctCells => throw _privateConstructorUsedError; - String get word => throw _privateConstructorUsedError; - String get type => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $MatrixQuestionCopyWith get copyWith => - throw _privateConstructorUsedError; + String get id; String get question; String? get image; String? get audio; List get rowHeaders; List get columnHeaders; List get correctCells; String get word; String get type; +/// Create a copy of MatrixQuestion +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$MatrixQuestionCopyWith get copyWith => _$MatrixQuestionCopyWithImpl(this as MatrixQuestion, _$identity); + + /// Serializes this MatrixQuestion to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is MatrixQuestion&&(identical(other.id, id) || other.id == id)&&(identical(other.question, question) || other.question == question)&&(identical(other.image, image) || other.image == image)&&(identical(other.audio, audio) || other.audio == audio)&&const DeepCollectionEquality().equals(other.rowHeaders, rowHeaders)&&const DeepCollectionEquality().equals(other.columnHeaders, columnHeaders)&&const DeepCollectionEquality().equals(other.correctCells, correctCells)&&(identical(other.word, word) || other.word == word)&&(identical(other.type, type) || other.type == type)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,question,image,audio,const DeepCollectionEquality().hash(rowHeaders),const DeepCollectionEquality().hash(columnHeaders),const DeepCollectionEquality().hash(correctCells),word,type); + +@override +String toString() { + return 'MatrixQuestion(id: $id, question: $question, image: $image, audio: $audio, rowHeaders: $rowHeaders, columnHeaders: $columnHeaders, correctCells: $correctCells, word: $word, type: $type)'; +} + + } /// @nodoc -abstract class $MatrixQuestionCopyWith<$Res> { - factory $MatrixQuestionCopyWith( - MatrixQuestion value, $Res Function(MatrixQuestion) then) = - _$MatrixQuestionCopyWithImpl<$Res, MatrixQuestion>; - @useResult - $Res call( - {String id, - String question, - String? image, - String? audio, - List rowHeaders, - List columnHeaders, - List correctCells, - String word, - String type}); -} +abstract mixin class $MatrixQuestionCopyWith<$Res> { + factory $MatrixQuestionCopyWith(MatrixQuestion value, $Res Function(MatrixQuestion) _then) = _$MatrixQuestionCopyWithImpl; +@useResult +$Res call({ + String id, String question, String? image, String? audio, List rowHeaders, List columnHeaders, List correctCells, String word, String type +}); + + + +} /// @nodoc -class _$MatrixQuestionCopyWithImpl<$Res, $Val extends MatrixQuestion> +class _$MatrixQuestionCopyWithImpl<$Res> implements $MatrixQuestionCopyWith<$Res> { - _$MatrixQuestionCopyWithImpl(this._value, this._then); + _$MatrixQuestionCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final MatrixQuestion _self; + final $Res Function(MatrixQuestion) _then; - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? question = null, - Object? image = freezed, - Object? audio = freezed, - Object? rowHeaders = null, - Object? columnHeaders = null, - Object? correctCells = null, - Object? word = null, - Object? type = null, - }) { - return _then(_value.copyWith( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - question: null == question - ? _value.question - : question // ignore: cast_nullable_to_non_nullable - as String, - image: freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - audio: freezed == audio - ? _value.audio - : audio // ignore: cast_nullable_to_non_nullable - as String?, - rowHeaders: null == rowHeaders - ? _value.rowHeaders - : rowHeaders // ignore: cast_nullable_to_non_nullable - as List, - columnHeaders: null == columnHeaders - ? _value.columnHeaders - : columnHeaders // ignore: cast_nullable_to_non_nullable - as List, - correctCells: null == correctCells - ? _value.correctCells - : correctCells // ignore: cast_nullable_to_non_nullable - as List, - word: null == word - ? _value.word - : word // ignore: cast_nullable_to_non_nullable - as String, - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String, - ) as $Val); - } +/// Create a copy of MatrixQuestion +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? question = null,Object? image = freezed,Object? audio = freezed,Object? rowHeaders = null,Object? columnHeaders = null,Object? correctCells = null,Object? word = null,Object? type = null,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,question: null == question ? _self.question : question // ignore: cast_nullable_to_non_nullable +as String,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?,audio: freezed == audio ? _self.audio : audio // ignore: cast_nullable_to_non_nullable +as String?,rowHeaders: null == rowHeaders ? _self.rowHeaders : rowHeaders // ignore: cast_nullable_to_non_nullable +as List,columnHeaders: null == columnHeaders ? _self.columnHeaders : columnHeaders // ignore: cast_nullable_to_non_nullable +as List,correctCells: null == correctCells ? _self.correctCells : correctCells // ignore: cast_nullable_to_non_nullable +as List,word: null == word ? _self.word : word // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -abstract class _$$MatrixQuestionImplCopyWith<$Res> - implements $MatrixQuestionCopyWith<$Res> { - factory _$$MatrixQuestionImplCopyWith(_$MatrixQuestionImpl value, - $Res Function(_$MatrixQuestionImpl) then) = - __$$MatrixQuestionImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String id, - String question, - String? image, - String? audio, - List rowHeaders, - List columnHeaders, - List correctCells, - String word, - String type}); } -/// @nodoc -class __$$MatrixQuestionImplCopyWithImpl<$Res> - extends _$MatrixQuestionCopyWithImpl<$Res, _$MatrixQuestionImpl> - implements _$$MatrixQuestionImplCopyWith<$Res> { - __$$MatrixQuestionImplCopyWithImpl( - _$MatrixQuestionImpl _value, $Res Function(_$MatrixQuestionImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? id = null, - Object? question = null, - Object? image = freezed, - Object? audio = freezed, - Object? rowHeaders = null, - Object? columnHeaders = null, - Object? correctCells = null, - Object? word = null, - Object? type = null, - }) { - return _then(_$MatrixQuestionImpl( - id: null == id - ? _value.id - : id // ignore: cast_nullable_to_non_nullable - as String, - question: null == question - ? _value.question - : question // ignore: cast_nullable_to_non_nullable - as String, - image: freezed == image - ? _value.image - : image // ignore: cast_nullable_to_non_nullable - as String?, - audio: freezed == audio - ? _value.audio - : audio // ignore: cast_nullable_to_non_nullable - as String?, - rowHeaders: null == rowHeaders - ? _value._rowHeaders - : rowHeaders // ignore: cast_nullable_to_non_nullable - as List, - columnHeaders: null == columnHeaders - ? _value._columnHeaders - : columnHeaders // ignore: cast_nullable_to_non_nullable - as List, - correctCells: null == correctCells - ? _value._correctCells - : correctCells // ignore: cast_nullable_to_non_nullable - as List, - word: null == word - ? _value.word - : word // ignore: cast_nullable_to_non_nullable - as String, - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as String, - )); - } +/// Adds pattern-matching-related methods to [MatrixQuestion]. +extension MatrixQuestionPatterns on MatrixQuestion { +/// 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 Function( _MatrixQuestion value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _MatrixQuestion() 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 Function( _MatrixQuestion value) $default,){ +final _that = this; +switch (_that) { +case _MatrixQuestion(): +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? Function( _MatrixQuestion value)? $default,){ +final _that = this; +switch (_that) { +case _MatrixQuestion() 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 Function( String id, String question, String? image, String? audio, List rowHeaders, List columnHeaders, List correctCells, String word, String type)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _MatrixQuestion() when $default != null: +return $default(_that.id,_that.question,_that.image,_that.audio,_that.rowHeaders,_that.columnHeaders,_that.correctCells,_that.word,_that.type);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 Function( String id, String question, String? image, String? audio, List rowHeaders, List columnHeaders, List correctCells, String word, String type) $default,) {final _that = this; +switch (_that) { +case _MatrixQuestion(): +return $default(_that.id,_that.question,_that.image,_that.audio,_that.rowHeaders,_that.columnHeaders,_that.correctCells,_that.word,_that.type);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? Function( String id, String question, String? image, String? audio, List rowHeaders, List columnHeaders, List correctCells, String word, String type)? $default,) {final _that = this; +switch (_that) { +case _MatrixQuestion() when $default != null: +return $default(_that.id,_that.question,_that.image,_that.audio,_that.rowHeaders,_that.columnHeaders,_that.correctCells,_that.word,_that.type);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$MatrixQuestionImpl implements _MatrixQuestion { - const _$MatrixQuestionImpl( - {required this.id, - required this.question, - this.image, - this.audio, - required final List rowHeaders, - required final List columnHeaders, - required final List correctCells, - required this.word, - this.type = 'matrix'}) - : _rowHeaders = rowHeaders, - _columnHeaders = columnHeaders, - _correctCells = correctCells; - factory _$MatrixQuestionImpl.fromJson(Map json) => - _$$MatrixQuestionImplFromJson(json); +class _MatrixQuestion implements MatrixQuestion { + const _MatrixQuestion({required this.id, required this.question, this.image, this.audio, required final List rowHeaders, required final List columnHeaders, required final List correctCells, required this.word, this.type = 'matrix'}): _rowHeaders = rowHeaders,_columnHeaders = columnHeaders,_correctCells = correctCells; + factory _MatrixQuestion.fromJson(Map json) => _$MatrixQuestionFromJson(json); - @override - final String id; - @override - final String question; - @override - final String? image; - @override - final String? audio; - final List _rowHeaders; - @override - List get rowHeaders { - if (_rowHeaders is EqualUnmodifiableListView) return _rowHeaders; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_rowHeaders); - } - - final List _columnHeaders; - @override - List get columnHeaders { - if (_columnHeaders is EqualUnmodifiableListView) return _columnHeaders; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_columnHeaders); - } - - final List _correctCells; - @override - List get correctCells { - if (_correctCells is EqualUnmodifiableListView) return _correctCells; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_correctCells); - } - - @override - final String word; - @override - @JsonKey() - final String type; - - @override - String toString() { - return 'MatrixQuestion(id: $id, question: $question, image: $image, audio: $audio, rowHeaders: $rowHeaders, columnHeaders: $columnHeaders, correctCells: $correctCells, word: $word, type: $type)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$MatrixQuestionImpl && - (identical(other.id, id) || other.id == id) && - (identical(other.question, question) || - other.question == question) && - (identical(other.image, image) || other.image == image) && - (identical(other.audio, audio) || other.audio == audio) && - const DeepCollectionEquality() - .equals(other._rowHeaders, _rowHeaders) && - const DeepCollectionEquality() - .equals(other._columnHeaders, _columnHeaders) && - const DeepCollectionEquality() - .equals(other._correctCells, _correctCells) && - (identical(other.word, word) || other.word == word) && - (identical(other.type, type) || other.type == type)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash( - runtimeType, - id, - question, - image, - audio, - const DeepCollectionEquality().hash(_rowHeaders), - const DeepCollectionEquality().hash(_columnHeaders), - const DeepCollectionEquality().hash(_correctCells), - word, - type); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$MatrixQuestionImplCopyWith<_$MatrixQuestionImpl> get copyWith => - __$$MatrixQuestionImplCopyWithImpl<_$MatrixQuestionImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$MatrixQuestionImplToJson( - this, - ); - } +@override final String id; +@override final String question; +@override final String? image; +@override final String? audio; + final List _rowHeaders; +@override List get rowHeaders { + if (_rowHeaders is EqualUnmodifiableListView) return _rowHeaders; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_rowHeaders); } -abstract class _MatrixQuestion implements MatrixQuestion { - const factory _MatrixQuestion( - {required final String id, - required final String question, - final String? image, - final String? audio, - required final List rowHeaders, - required final List columnHeaders, - required final List correctCells, - required final String word, - final String type}) = _$MatrixQuestionImpl; - - factory _MatrixQuestion.fromJson(Map json) = - _$MatrixQuestionImpl.fromJson; - - @override - String get id; - @override - String get question; - @override - String? get image; - @override - String? get audio; - @override - List get rowHeaders; - @override - List get columnHeaders; - @override - List get correctCells; - @override - String get word; - @override - String get type; - @override - @JsonKey(ignore: true) - _$$MatrixQuestionImplCopyWith<_$MatrixQuestionImpl> get copyWith => - throw _privateConstructorUsedError; + final List _columnHeaders; +@override List get columnHeaders { + if (_columnHeaders is EqualUnmodifiableListView) return _columnHeaders; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_columnHeaders); } -MatrixCell _$MatrixCellFromJson(Map json) { - return _MatrixCell.fromJson(json); + final List _correctCells; +@override List get correctCells { + if (_correctCells is EqualUnmodifiableListView) return _correctCells; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_correctCells); } +@override final String word; +@override@JsonKey() final String type; + +/// Create a copy of MatrixQuestion +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$MatrixQuestionCopyWith<_MatrixQuestion> get copyWith => __$MatrixQuestionCopyWithImpl<_MatrixQuestion>(this, _$identity); + +@override +Map toJson() { + return _$MatrixQuestionToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _MatrixQuestion&&(identical(other.id, id) || other.id == id)&&(identical(other.question, question) || other.question == question)&&(identical(other.image, image) || other.image == image)&&(identical(other.audio, audio) || other.audio == audio)&&const DeepCollectionEquality().equals(other._rowHeaders, _rowHeaders)&&const DeepCollectionEquality().equals(other._columnHeaders, _columnHeaders)&&const DeepCollectionEquality().equals(other._correctCells, _correctCells)&&(identical(other.word, word) || other.word == word)&&(identical(other.type, type) || other.type == type)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,question,image,audio,const DeepCollectionEquality().hash(_rowHeaders),const DeepCollectionEquality().hash(_columnHeaders),const DeepCollectionEquality().hash(_correctCells),word,type); + +@override +String toString() { + return 'MatrixQuestion(id: $id, question: $question, image: $image, audio: $audio, rowHeaders: $rowHeaders, columnHeaders: $columnHeaders, correctCells: $correctCells, word: $word, type: $type)'; +} + + +} + +/// @nodoc +abstract mixin class _$MatrixQuestionCopyWith<$Res> implements $MatrixQuestionCopyWith<$Res> { + factory _$MatrixQuestionCopyWith(_MatrixQuestion value, $Res Function(_MatrixQuestion) _then) = __$MatrixQuestionCopyWithImpl; +@override @useResult +$Res call({ + String id, String question, String? image, String? audio, List rowHeaders, List columnHeaders, List correctCells, String word, String type +}); + + + + +} +/// @nodoc +class __$MatrixQuestionCopyWithImpl<$Res> + implements _$MatrixQuestionCopyWith<$Res> { + __$MatrixQuestionCopyWithImpl(this._self, this._then); + + final _MatrixQuestion _self; + final $Res Function(_MatrixQuestion) _then; + +/// Create a copy of MatrixQuestion +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? question = null,Object? image = freezed,Object? audio = freezed,Object? rowHeaders = null,Object? columnHeaders = null,Object? correctCells = null,Object? word = null,Object? type = null,}) { + return _then(_MatrixQuestion( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,question: null == question ? _self.question : question // ignore: cast_nullable_to_non_nullable +as String,image: freezed == image ? _self.image : image // ignore: cast_nullable_to_non_nullable +as String?,audio: freezed == audio ? _self.audio : audio // ignore: cast_nullable_to_non_nullable +as String?,rowHeaders: null == rowHeaders ? _self._rowHeaders : rowHeaders // ignore: cast_nullable_to_non_nullable +as List,columnHeaders: null == columnHeaders ? _self._columnHeaders : columnHeaders // ignore: cast_nullable_to_non_nullable +as List,correctCells: null == correctCells ? _self._correctCells : correctCells // ignore: cast_nullable_to_non_nullable +as List,word: null == word ? _self.word : word // ignore: cast_nullable_to_non_nullable +as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + + /// @nodoc mixin _$MatrixCell { - int get rowIndex => throw _privateConstructorUsedError; - int get columnIndex => throw _privateConstructorUsedError; - String get value => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $MatrixCellCopyWith get copyWith => - throw _privateConstructorUsedError; + int get rowIndex; int get columnIndex; String get value; +/// Create a copy of MatrixCell +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$MatrixCellCopyWith get copyWith => _$MatrixCellCopyWithImpl(this as MatrixCell, _$identity); + + /// Serializes this MatrixCell to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is MatrixCell&&(identical(other.rowIndex, rowIndex) || other.rowIndex == rowIndex)&&(identical(other.columnIndex, columnIndex) || other.columnIndex == columnIndex)&&(identical(other.value, value) || other.value == value)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,rowIndex,columnIndex,value); + +@override +String toString() { + return 'MatrixCell(rowIndex: $rowIndex, columnIndex: $columnIndex, value: $value)'; +} + + } /// @nodoc -abstract class $MatrixCellCopyWith<$Res> { - factory $MatrixCellCopyWith( - MatrixCell value, $Res Function(MatrixCell) then) = - _$MatrixCellCopyWithImpl<$Res, MatrixCell>; - @useResult - $Res call({int rowIndex, int columnIndex, String value}); -} +abstract mixin class $MatrixCellCopyWith<$Res> { + factory $MatrixCellCopyWith(MatrixCell value, $Res Function(MatrixCell) _then) = _$MatrixCellCopyWithImpl; +@useResult +$Res call({ + int rowIndex, int columnIndex, String value +}); + + + +} /// @nodoc -class _$MatrixCellCopyWithImpl<$Res, $Val extends MatrixCell> +class _$MatrixCellCopyWithImpl<$Res> implements $MatrixCellCopyWith<$Res> { - _$MatrixCellCopyWithImpl(this._value, this._then); + _$MatrixCellCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final MatrixCell _self; + final $Res Function(MatrixCell) _then; - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? rowIndex = null, - Object? columnIndex = null, - Object? value = null, - }) { - return _then(_value.copyWith( - rowIndex: null == rowIndex - ? _value.rowIndex - : rowIndex // ignore: cast_nullable_to_non_nullable - as int, - columnIndex: null == columnIndex - ? _value.columnIndex - : columnIndex // ignore: cast_nullable_to_non_nullable - as int, - value: null == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String, - ) as $Val); - } +/// Create a copy of MatrixCell +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? rowIndex = null,Object? columnIndex = null,Object? value = null,}) { + return _then(_self.copyWith( +rowIndex: null == rowIndex ? _self.rowIndex : rowIndex // ignore: cast_nullable_to_non_nullable +as int,columnIndex: null == columnIndex ? _self.columnIndex : columnIndex // ignore: cast_nullable_to_non_nullable +as int,value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -abstract class _$$MatrixCellImplCopyWith<$Res> - implements $MatrixCellCopyWith<$Res> { - factory _$$MatrixCellImplCopyWith( - _$MatrixCellImpl value, $Res Function(_$MatrixCellImpl) then) = - __$$MatrixCellImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({int rowIndex, int columnIndex, String value}); } -/// @nodoc -class __$$MatrixCellImplCopyWithImpl<$Res> - extends _$MatrixCellCopyWithImpl<$Res, _$MatrixCellImpl> - implements _$$MatrixCellImplCopyWith<$Res> { - __$$MatrixCellImplCopyWithImpl( - _$MatrixCellImpl _value, $Res Function(_$MatrixCellImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? rowIndex = null, - Object? columnIndex = null, - Object? value = null, - }) { - return _then(_$MatrixCellImpl( - rowIndex: null == rowIndex - ? _value.rowIndex - : rowIndex // ignore: cast_nullable_to_non_nullable - as int, - columnIndex: null == columnIndex - ? _value.columnIndex - : columnIndex // ignore: cast_nullable_to_non_nullable - as int, - value: null == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String, - )); - } +/// Adds pattern-matching-related methods to [MatrixCell]. +extension MatrixCellPatterns on MatrixCell { +/// 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 Function( _MatrixCell value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _MatrixCell() 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 Function( _MatrixCell value) $default,){ +final _that = this; +switch (_that) { +case _MatrixCell(): +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? Function( _MatrixCell value)? $default,){ +final _that = this; +switch (_that) { +case _MatrixCell() 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 Function( int rowIndex, int columnIndex, String value)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _MatrixCell() when $default != null: +return $default(_that.rowIndex,_that.columnIndex,_that.value);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 Function( int rowIndex, int columnIndex, String value) $default,) {final _that = this; +switch (_that) { +case _MatrixCell(): +return $default(_that.rowIndex,_that.columnIndex,_that.value);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? Function( int rowIndex, int columnIndex, String value)? $default,) {final _that = this; +switch (_that) { +case _MatrixCell() when $default != null: +return $default(_that.rowIndex,_that.columnIndex,_that.value);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$MatrixCellImpl implements _MatrixCell { - const _$MatrixCellImpl( - {required this.rowIndex, required this.columnIndex, required this.value}); - factory _$MatrixCellImpl.fromJson(Map json) => - _$$MatrixCellImplFromJson(json); +class _MatrixCell implements MatrixCell { + const _MatrixCell({required this.rowIndex, required this.columnIndex, required this.value}); + factory _MatrixCell.fromJson(Map json) => _$MatrixCellFromJson(json); - @override - final int rowIndex; - @override - final int columnIndex; - @override - final String value; +@override final int rowIndex; +@override final int columnIndex; +@override final String value; - @override - String toString() { - return 'MatrixCell(rowIndex: $rowIndex, columnIndex: $columnIndex, value: $value)'; - } +/// Create a copy of MatrixCell +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$MatrixCellCopyWith<_MatrixCell> get copyWith => __$MatrixCellCopyWithImpl<_MatrixCell>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$MatrixCellImpl && - (identical(other.rowIndex, rowIndex) || - other.rowIndex == rowIndex) && - (identical(other.columnIndex, columnIndex) || - other.columnIndex == columnIndex) && - (identical(other.value, value) || other.value == value)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash(runtimeType, rowIndex, columnIndex, value); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$MatrixCellImplCopyWith<_$MatrixCellImpl> get copyWith => - __$$MatrixCellImplCopyWithImpl<_$MatrixCellImpl>(this, _$identity); - - @override - Map toJson() { - return _$$MatrixCellImplToJson( - this, - ); - } +@override +Map toJson() { + return _$MatrixCellToJson(this, ); } -abstract class _MatrixCell implements MatrixCell { - const factory _MatrixCell( - {required final int rowIndex, - required final int columnIndex, - required final String value}) = _$MatrixCellImpl; - - factory _MatrixCell.fromJson(Map json) = - _$MatrixCellImpl.fromJson; - - @override - int get rowIndex; - @override - int get columnIndex; - @override - String get value; - @override - @JsonKey(ignore: true) - _$$MatrixCellImplCopyWith<_$MatrixCellImpl> get copyWith => - throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _MatrixCell&&(identical(other.rowIndex, rowIndex) || other.rowIndex == rowIndex)&&(identical(other.columnIndex, columnIndex) || other.columnIndex == columnIndex)&&(identical(other.value, value) || other.value == value)); } -QuestionResult _$QuestionResultFromJson(Map json) { - return _QuestionResult.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,rowIndex,columnIndex,value); + +@override +String toString() { + return 'MatrixCell(rowIndex: $rowIndex, columnIndex: $columnIndex, value: $value)'; } + +} + +/// @nodoc +abstract mixin class _$MatrixCellCopyWith<$Res> implements $MatrixCellCopyWith<$Res> { + factory _$MatrixCellCopyWith(_MatrixCell value, $Res Function(_MatrixCell) _then) = __$MatrixCellCopyWithImpl; +@override @useResult +$Res call({ + int rowIndex, int columnIndex, String value +}); + + + + +} +/// @nodoc +class __$MatrixCellCopyWithImpl<$Res> + implements _$MatrixCellCopyWith<$Res> { + __$MatrixCellCopyWithImpl(this._self, this._then); + + final _MatrixCell _self; + final $Res Function(_MatrixCell) _then; + +/// Create a copy of MatrixCell +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? rowIndex = null,Object? columnIndex = null,Object? value = null,}) { + return _then(_MatrixCell( +rowIndex: null == rowIndex ? _self.rowIndex : rowIndex // ignore: cast_nullable_to_non_nullable +as int,columnIndex: null == columnIndex ? _self.columnIndex : columnIndex // ignore: cast_nullable_to_non_nullable +as int,value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + + /// @nodoc mixin _$QuestionResult { - String get questionId => throw _privateConstructorUsedError; - String get word => throw _privateConstructorUsedError; - bool get isCorrect => throw _privateConstructorUsedError; - Duration get timeSpent => throw _privateConstructorUsedError; - String? get selectedAnswer => throw _privateConstructorUsedError; - List? get selectedAnswers => - throw _privateConstructorUsedError; // for multiple selections - DateTime? get answeredAt => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $QuestionResultCopyWith get copyWith => - throw _privateConstructorUsedError; + String get questionId; String get word; bool get isCorrect; Duration get timeSpent; String? get selectedAnswer; List? get selectedAnswers;// for multiple selections + DateTime? get answeredAt; +/// Create a copy of QuestionResult +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$QuestionResultCopyWith get copyWith => _$QuestionResultCopyWithImpl(this as QuestionResult, _$identity); + + /// Serializes this QuestionResult to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is QuestionResult&&(identical(other.questionId, questionId) || other.questionId == questionId)&&(identical(other.word, word) || other.word == word)&&(identical(other.isCorrect, isCorrect) || other.isCorrect == isCorrect)&&(identical(other.timeSpent, timeSpent) || other.timeSpent == timeSpent)&&(identical(other.selectedAnswer, selectedAnswer) || other.selectedAnswer == selectedAnswer)&&const DeepCollectionEquality().equals(other.selectedAnswers, selectedAnswers)&&(identical(other.answeredAt, answeredAt) || other.answeredAt == answeredAt)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,questionId,word,isCorrect,timeSpent,selectedAnswer,const DeepCollectionEquality().hash(selectedAnswers),answeredAt); + +@override +String toString() { + return 'QuestionResult(questionId: $questionId, word: $word, isCorrect: $isCorrect, timeSpent: $timeSpent, selectedAnswer: $selectedAnswer, selectedAnswers: $selectedAnswers, answeredAt: $answeredAt)'; +} + + } /// @nodoc -abstract class $QuestionResultCopyWith<$Res> { - factory $QuestionResultCopyWith( - QuestionResult value, $Res Function(QuestionResult) then) = - _$QuestionResultCopyWithImpl<$Res, QuestionResult>; - @useResult - $Res call( - {String questionId, - String word, - bool isCorrect, - Duration timeSpent, - String? selectedAnswer, - List? selectedAnswers, - DateTime? answeredAt}); -} +abstract mixin class $QuestionResultCopyWith<$Res> { + factory $QuestionResultCopyWith(QuestionResult value, $Res Function(QuestionResult) _then) = _$QuestionResultCopyWithImpl; +@useResult +$Res call({ + String questionId, String word, bool isCorrect, Duration timeSpent, String? selectedAnswer, List? selectedAnswers, DateTime? answeredAt +}); + + + +} /// @nodoc -class _$QuestionResultCopyWithImpl<$Res, $Val extends QuestionResult> +class _$QuestionResultCopyWithImpl<$Res> implements $QuestionResultCopyWith<$Res> { - _$QuestionResultCopyWithImpl(this._value, this._then); + _$QuestionResultCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final QuestionResult _self; + final $Res Function(QuestionResult) _then; - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? questionId = null, - Object? word = null, - Object? isCorrect = null, - Object? timeSpent = null, - Object? selectedAnswer = freezed, - Object? selectedAnswers = freezed, - Object? answeredAt = freezed, - }) { - return _then(_value.copyWith( - questionId: null == questionId - ? _value.questionId - : questionId // ignore: cast_nullable_to_non_nullable - as String, - word: null == word - ? _value.word - : word // ignore: cast_nullable_to_non_nullable - as String, - isCorrect: null == isCorrect - ? _value.isCorrect - : isCorrect // ignore: cast_nullable_to_non_nullable - as bool, - timeSpent: null == timeSpent - ? _value.timeSpent - : timeSpent // ignore: cast_nullable_to_non_nullable - as Duration, - selectedAnswer: freezed == selectedAnswer - ? _value.selectedAnswer - : selectedAnswer // ignore: cast_nullable_to_non_nullable - as String?, - selectedAnswers: freezed == selectedAnswers - ? _value.selectedAnswers - : selectedAnswers // ignore: cast_nullable_to_non_nullable - as List?, - answeredAt: freezed == answeredAt - ? _value.answeredAt - : answeredAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - ) as $Val); - } +/// Create a copy of QuestionResult +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? questionId = null,Object? word = null,Object? isCorrect = null,Object? timeSpent = null,Object? selectedAnswer = freezed,Object? selectedAnswers = freezed,Object? answeredAt = freezed,}) { + return _then(_self.copyWith( +questionId: null == questionId ? _self.questionId : questionId // ignore: cast_nullable_to_non_nullable +as String,word: null == word ? _self.word : word // ignore: cast_nullable_to_non_nullable +as String,isCorrect: null == isCorrect ? _self.isCorrect : isCorrect // ignore: cast_nullable_to_non_nullable +as bool,timeSpent: null == timeSpent ? _self.timeSpent : timeSpent // ignore: cast_nullable_to_non_nullable +as Duration,selectedAnswer: freezed == selectedAnswer ? _self.selectedAnswer : selectedAnswer // ignore: cast_nullable_to_non_nullable +as String?,selectedAnswers: freezed == selectedAnswers ? _self.selectedAnswers : selectedAnswers // ignore: cast_nullable_to_non_nullable +as List?,answeredAt: freezed == answeredAt ? _self.answeredAt : answeredAt // ignore: cast_nullable_to_non_nullable +as DateTime?, + )); } -/// @nodoc -abstract class _$$QuestionResultImplCopyWith<$Res> - implements $QuestionResultCopyWith<$Res> { - factory _$$QuestionResultImplCopyWith(_$QuestionResultImpl value, - $Res Function(_$QuestionResultImpl) then) = - __$$QuestionResultImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String questionId, - String word, - bool isCorrect, - Duration timeSpent, - String? selectedAnswer, - List? selectedAnswers, - DateTime? answeredAt}); } -/// @nodoc -class __$$QuestionResultImplCopyWithImpl<$Res> - extends _$QuestionResultCopyWithImpl<$Res, _$QuestionResultImpl> - implements _$$QuestionResultImplCopyWith<$Res> { - __$$QuestionResultImplCopyWithImpl( - _$QuestionResultImpl _value, $Res Function(_$QuestionResultImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? questionId = null, - Object? word = null, - Object? isCorrect = null, - Object? timeSpent = null, - Object? selectedAnswer = freezed, - Object? selectedAnswers = freezed, - Object? answeredAt = freezed, - }) { - return _then(_$QuestionResultImpl( - questionId: null == questionId - ? _value.questionId - : questionId // ignore: cast_nullable_to_non_nullable - as String, - word: null == word - ? _value.word - : word // ignore: cast_nullable_to_non_nullable - as String, - isCorrect: null == isCorrect - ? _value.isCorrect - : isCorrect // ignore: cast_nullable_to_non_nullable - as bool, - timeSpent: null == timeSpent - ? _value.timeSpent - : timeSpent // ignore: cast_nullable_to_non_nullable - as Duration, - selectedAnswer: freezed == selectedAnswer - ? _value.selectedAnswer - : selectedAnswer // ignore: cast_nullable_to_non_nullable - as String?, - selectedAnswers: freezed == selectedAnswers - ? _value._selectedAnswers - : selectedAnswers // ignore: cast_nullable_to_non_nullable - as List?, - answeredAt: freezed == answeredAt - ? _value.answeredAt - : answeredAt // ignore: cast_nullable_to_non_nullable - as DateTime?, - )); - } +/// Adds pattern-matching-related methods to [QuestionResult]. +extension QuestionResultPatterns on QuestionResult { +/// 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 Function( _QuestionResult value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _QuestionResult() 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 Function( _QuestionResult value) $default,){ +final _that = this; +switch (_that) { +case _QuestionResult(): +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? Function( _QuestionResult value)? $default,){ +final _that = this; +switch (_that) { +case _QuestionResult() 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 Function( String questionId, String word, bool isCorrect, Duration timeSpent, String? selectedAnswer, List? selectedAnswers, DateTime? answeredAt)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _QuestionResult() when $default != null: +return $default(_that.questionId,_that.word,_that.isCorrect,_that.timeSpent,_that.selectedAnswer,_that.selectedAnswers,_that.answeredAt);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 Function( String questionId, String word, bool isCorrect, Duration timeSpent, String? selectedAnswer, List? selectedAnswers, DateTime? answeredAt) $default,) {final _that = this; +switch (_that) { +case _QuestionResult(): +return $default(_that.questionId,_that.word,_that.isCorrect,_that.timeSpent,_that.selectedAnswer,_that.selectedAnswers,_that.answeredAt);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? Function( String questionId, String word, bool isCorrect, Duration timeSpent, String? selectedAnswer, List? selectedAnswers, DateTime? answeredAt)? $default,) {final _that = this; +switch (_that) { +case _QuestionResult() when $default != null: +return $default(_that.questionId,_that.word,_that.isCorrect,_that.timeSpent,_that.selectedAnswer,_that.selectedAnswers,_that.answeredAt);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$QuestionResultImpl implements _QuestionResult { - const _$QuestionResultImpl( - {required this.questionId, - required this.word, - required this.isCorrect, - required this.timeSpent, - this.selectedAnswer, - final List? selectedAnswers, - this.answeredAt}) - : _selectedAnswers = selectedAnswers; - factory _$QuestionResultImpl.fromJson(Map json) => - _$$QuestionResultImplFromJson(json); +class _QuestionResult implements QuestionResult { + const _QuestionResult({required this.questionId, required this.word, required this.isCorrect, required this.timeSpent, this.selectedAnswer, final List? selectedAnswers, this.answeredAt}): _selectedAnswers = selectedAnswers; + factory _QuestionResult.fromJson(Map json) => _$QuestionResultFromJson(json); - @override - final String questionId; - @override - final String word; - @override - final bool isCorrect; - @override - final Duration timeSpent; - @override - final String? selectedAnswer; - final List? _selectedAnswers; - @override - List? get selectedAnswers { - final value = _selectedAnswers; - if (value == null) return null; - if (_selectedAnswers is EqualUnmodifiableListView) return _selectedAnswers; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } +@override final String questionId; +@override final String word; +@override final bool isCorrect; +@override final Duration timeSpent; +@override final String? selectedAnswer; + final List? _selectedAnswers; +@override List? get selectedAnswers { + final value = _selectedAnswers; + if (value == null) return null; + if (_selectedAnswers is EqualUnmodifiableListView) return _selectedAnswers; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); +} // for multiple selections - @override - final DateTime? answeredAt; +@override final DateTime? answeredAt; - @override - String toString() { - return 'QuestionResult(questionId: $questionId, word: $word, isCorrect: $isCorrect, timeSpent: $timeSpent, selectedAnswer: $selectedAnswer, selectedAnswers: $selectedAnswers, answeredAt: $answeredAt)'; - } +/// Create a copy of QuestionResult +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$QuestionResultCopyWith<_QuestionResult> get copyWith => __$QuestionResultCopyWithImpl<_QuestionResult>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$QuestionResultImpl && - (identical(other.questionId, questionId) || - other.questionId == questionId) && - (identical(other.word, word) || other.word == word) && - (identical(other.isCorrect, isCorrect) || - other.isCorrect == isCorrect) && - (identical(other.timeSpent, timeSpent) || - other.timeSpent == timeSpent) && - (identical(other.selectedAnswer, selectedAnswer) || - other.selectedAnswer == selectedAnswer) && - const DeepCollectionEquality() - .equals(other._selectedAnswers, _selectedAnswers) && - (identical(other.answeredAt, answeredAt) || - other.answeredAt == answeredAt)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash( - runtimeType, - questionId, - word, - isCorrect, - timeSpent, - selectedAnswer, - const DeepCollectionEquality().hash(_selectedAnswers), - answeredAt); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$QuestionResultImplCopyWith<_$QuestionResultImpl> get copyWith => - __$$QuestionResultImplCopyWithImpl<_$QuestionResultImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$QuestionResultImplToJson( - this, - ); - } +@override +Map toJson() { + return _$QuestionResultToJson(this, ); } -abstract class _QuestionResult implements QuestionResult { - const factory _QuestionResult( - {required final String questionId, - required final String word, - required final bool isCorrect, - required final Duration timeSpent, - final String? selectedAnswer, - final List? selectedAnswers, - final DateTime? answeredAt}) = _$QuestionResultImpl; - - factory _QuestionResult.fromJson(Map json) = - _$QuestionResultImpl.fromJson; - - @override - String get questionId; - @override - String get word; - @override - bool get isCorrect; - @override - Duration get timeSpent; - @override - String? get selectedAnswer; - @override - List? get selectedAnswers; - @override // for multiple selections - DateTime? get answeredAt; - @override - @JsonKey(ignore: true) - _$$QuestionResultImplCopyWith<_$QuestionResultImpl> get copyWith => - throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _QuestionResult&&(identical(other.questionId, questionId) || other.questionId == questionId)&&(identical(other.word, word) || other.word == word)&&(identical(other.isCorrect, isCorrect) || other.isCorrect == isCorrect)&&(identical(other.timeSpent, timeSpent) || other.timeSpent == timeSpent)&&(identical(other.selectedAnswer, selectedAnswer) || other.selectedAnswer == selectedAnswer)&&const DeepCollectionEquality().equals(other._selectedAnswers, _selectedAnswers)&&(identical(other.answeredAt, answeredAt) || other.answeredAt == answeredAt)); } -GameSessionResult _$GameSessionResultFromJson(Map json) { - return _GameSessionResult.fromJson(json); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,questionId,word,isCorrect,timeSpent,selectedAnswer,const DeepCollectionEquality().hash(_selectedAnswers),answeredAt); + +@override +String toString() { + return 'QuestionResult(questionId: $questionId, word: $word, isCorrect: $isCorrect, timeSpent: $timeSpent, selectedAnswer: $selectedAnswer, selectedAnswers: $selectedAnswers, answeredAt: $answeredAt)'; } + +} + +/// @nodoc +abstract mixin class _$QuestionResultCopyWith<$Res> implements $QuestionResultCopyWith<$Res> { + factory _$QuestionResultCopyWith(_QuestionResult value, $Res Function(_QuestionResult) _then) = __$QuestionResultCopyWithImpl; +@override @useResult +$Res call({ + String questionId, String word, bool isCorrect, Duration timeSpent, String? selectedAnswer, List? selectedAnswers, DateTime? answeredAt +}); + + + + +} +/// @nodoc +class __$QuestionResultCopyWithImpl<$Res> + implements _$QuestionResultCopyWith<$Res> { + __$QuestionResultCopyWithImpl(this._self, this._then); + + final _QuestionResult _self; + final $Res Function(_QuestionResult) _then; + +/// Create a copy of QuestionResult +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? questionId = null,Object? word = null,Object? isCorrect = null,Object? timeSpent = null,Object? selectedAnswer = freezed,Object? selectedAnswers = freezed,Object? answeredAt = freezed,}) { + return _then(_QuestionResult( +questionId: null == questionId ? _self.questionId : questionId // ignore: cast_nullable_to_non_nullable +as String,word: null == word ? _self.word : word // ignore: cast_nullable_to_non_nullable +as String,isCorrect: null == isCorrect ? _self.isCorrect : isCorrect // ignore: cast_nullable_to_non_nullable +as bool,timeSpent: null == timeSpent ? _self.timeSpent : timeSpent // ignore: cast_nullable_to_non_nullable +as Duration,selectedAnswer: freezed == selectedAnswer ? _self.selectedAnswer : selectedAnswer // ignore: cast_nullable_to_non_nullable +as String?,selectedAnswers: freezed == selectedAnswers ? _self._selectedAnswers : selectedAnswers // ignore: cast_nullable_to_non_nullable +as List?,answeredAt: freezed == answeredAt ? _self.answeredAt : answeredAt // ignore: cast_nullable_to_non_nullable +as DateTime?, + )); +} + + +} + + /// @nodoc mixin _$GameSessionResult { - String get testId => throw _privateConstructorUsedError; - List get questionResults => - throw _privateConstructorUsedError; - Duration get totalTime => throw _privateConstructorUsedError; - int get correctAnswers => throw _privateConstructorUsedError; - int get totalQuestions => throw _privateConstructorUsedError; - DateTime get completedAt => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $GameSessionResultCopyWith get copyWith => - throw _privateConstructorUsedError; + String get testId; List get questionResults; Duration get totalTime; int get correctAnswers; int get totalQuestions; DateTime get completedAt; +/// Create a copy of GameSessionResult +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$GameSessionResultCopyWith get copyWith => _$GameSessionResultCopyWithImpl(this as GameSessionResult, _$identity); + + /// Serializes this GameSessionResult to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GameSessionResult&&(identical(other.testId, testId) || other.testId == testId)&&const DeepCollectionEquality().equals(other.questionResults, questionResults)&&(identical(other.totalTime, totalTime) || other.totalTime == totalTime)&&(identical(other.correctAnswers, correctAnswers) || other.correctAnswers == correctAnswers)&&(identical(other.totalQuestions, totalQuestions) || other.totalQuestions == totalQuestions)&&(identical(other.completedAt, completedAt) || other.completedAt == completedAt)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,testId,const DeepCollectionEquality().hash(questionResults),totalTime,correctAnswers,totalQuestions,completedAt); + +@override +String toString() { + return 'GameSessionResult(testId: $testId, questionResults: $questionResults, totalTime: $totalTime, correctAnswers: $correctAnswers, totalQuestions: $totalQuestions, completedAt: $completedAt)'; +} + + } /// @nodoc -abstract class $GameSessionResultCopyWith<$Res> { - factory $GameSessionResultCopyWith( - GameSessionResult value, $Res Function(GameSessionResult) then) = - _$GameSessionResultCopyWithImpl<$Res, GameSessionResult>; - @useResult - $Res call( - {String testId, - List questionResults, - Duration totalTime, - int correctAnswers, - int totalQuestions, - DateTime completedAt}); -} +abstract mixin class $GameSessionResultCopyWith<$Res> { + factory $GameSessionResultCopyWith(GameSessionResult value, $Res Function(GameSessionResult) _then) = _$GameSessionResultCopyWithImpl; +@useResult +$Res call({ + String testId, List questionResults, Duration totalTime, int correctAnswers, int totalQuestions, DateTime completedAt +}); + + + +} /// @nodoc -class _$GameSessionResultCopyWithImpl<$Res, $Val extends GameSessionResult> +class _$GameSessionResultCopyWithImpl<$Res> implements $GameSessionResultCopyWith<$Res> { - _$GameSessionResultCopyWithImpl(this._value, this._then); + _$GameSessionResultCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final GameSessionResult _self; + final $Res Function(GameSessionResult) _then; - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? testId = null, - Object? questionResults = null, - Object? totalTime = null, - Object? correctAnswers = null, - Object? totalQuestions = null, - Object? completedAt = null, - }) { - return _then(_value.copyWith( - testId: null == testId - ? _value.testId - : testId // ignore: cast_nullable_to_non_nullable - as String, - questionResults: null == questionResults - ? _value.questionResults - : questionResults // ignore: cast_nullable_to_non_nullable - as List, - totalTime: null == totalTime - ? _value.totalTime - : totalTime // ignore: cast_nullable_to_non_nullable - as Duration, - correctAnswers: null == correctAnswers - ? _value.correctAnswers - : correctAnswers // ignore: cast_nullable_to_non_nullable - as int, - totalQuestions: null == totalQuestions - ? _value.totalQuestions - : totalQuestions // ignore: cast_nullable_to_non_nullable - as int, - completedAt: null == completedAt - ? _value.completedAt - : completedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - ) as $Val); - } +/// Create a copy of GameSessionResult +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? testId = null,Object? questionResults = null,Object? totalTime = null,Object? correctAnswers = null,Object? totalQuestions = null,Object? completedAt = null,}) { + return _then(_self.copyWith( +testId: null == testId ? _self.testId : testId // ignore: cast_nullable_to_non_nullable +as String,questionResults: null == questionResults ? _self.questionResults : questionResults // ignore: cast_nullable_to_non_nullable +as List,totalTime: null == totalTime ? _self.totalTime : totalTime // ignore: cast_nullable_to_non_nullable +as Duration,correctAnswers: null == correctAnswers ? _self.correctAnswers : correctAnswers // ignore: cast_nullable_to_non_nullable +as int,totalQuestions: null == totalQuestions ? _self.totalQuestions : totalQuestions // ignore: cast_nullable_to_non_nullable +as int,completedAt: null == completedAt ? _self.completedAt : completedAt // ignore: cast_nullable_to_non_nullable +as DateTime, + )); } -/// @nodoc -abstract class _$$GameSessionResultImplCopyWith<$Res> - implements $GameSessionResultCopyWith<$Res> { - factory _$$GameSessionResultImplCopyWith(_$GameSessionResultImpl value, - $Res Function(_$GameSessionResultImpl) then) = - __$$GameSessionResultImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String testId, - List questionResults, - Duration totalTime, - int correctAnswers, - int totalQuestions, - DateTime completedAt}); } -/// @nodoc -class __$$GameSessionResultImplCopyWithImpl<$Res> - extends _$GameSessionResultCopyWithImpl<$Res, _$GameSessionResultImpl> - implements _$$GameSessionResultImplCopyWith<$Res> { - __$$GameSessionResultImplCopyWithImpl(_$GameSessionResultImpl _value, - $Res Function(_$GameSessionResultImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? testId = null, - Object? questionResults = null, - Object? totalTime = null, - Object? correctAnswers = null, - Object? totalQuestions = null, - Object? completedAt = null, - }) { - return _then(_$GameSessionResultImpl( - testId: null == testId - ? _value.testId - : testId // ignore: cast_nullable_to_non_nullable - as String, - questionResults: null == questionResults - ? _value._questionResults - : questionResults // ignore: cast_nullable_to_non_nullable - as List, - totalTime: null == totalTime - ? _value.totalTime - : totalTime // ignore: cast_nullable_to_non_nullable - as Duration, - correctAnswers: null == correctAnswers - ? _value.correctAnswers - : correctAnswers // ignore: cast_nullable_to_non_nullable - as int, - totalQuestions: null == totalQuestions - ? _value.totalQuestions - : totalQuestions // ignore: cast_nullable_to_non_nullable - as int, - completedAt: null == completedAt - ? _value.completedAt - : completedAt // ignore: cast_nullable_to_non_nullable - as DateTime, - )); - } +/// Adds pattern-matching-related methods to [GameSessionResult]. +extension GameSessionResultPatterns on GameSessionResult { +/// 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 Function( _GameSessionResult value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _GameSessionResult() 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 Function( _GameSessionResult value) $default,){ +final _that = this; +switch (_that) { +case _GameSessionResult(): +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? Function( _GameSessionResult value)? $default,){ +final _that = this; +switch (_that) { +case _GameSessionResult() 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 Function( String testId, List questionResults, Duration totalTime, int correctAnswers, int totalQuestions, DateTime completedAt)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _GameSessionResult() when $default != null: +return $default(_that.testId,_that.questionResults,_that.totalTime,_that.correctAnswers,_that.totalQuestions,_that.completedAt);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 Function( String testId, List questionResults, Duration totalTime, int correctAnswers, int totalQuestions, DateTime completedAt) $default,) {final _that = this; +switch (_that) { +case _GameSessionResult(): +return $default(_that.testId,_that.questionResults,_that.totalTime,_that.correctAnswers,_that.totalQuestions,_that.completedAt);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? Function( String testId, List questionResults, Duration totalTime, int correctAnswers, int totalQuestions, DateTime completedAt)? $default,) {final _that = this; +switch (_that) { +case _GameSessionResult() when $default != null: +return $default(_that.testId,_that.questionResults,_that.totalTime,_that.correctAnswers,_that.totalQuestions,_that.completedAt);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$GameSessionResultImpl implements _GameSessionResult { - const _$GameSessionResultImpl( - {required this.testId, - required final List questionResults, - required this.totalTime, - required this.correctAnswers, - required this.totalQuestions, - required this.completedAt}) - : _questionResults = questionResults; - factory _$GameSessionResultImpl.fromJson(Map json) => - _$$GameSessionResultImplFromJson(json); +class _GameSessionResult implements GameSessionResult { + const _GameSessionResult({required this.testId, required final List questionResults, required this.totalTime, required this.correctAnswers, required this.totalQuestions, required this.completedAt}): _questionResults = questionResults; + factory _GameSessionResult.fromJson(Map json) => _$GameSessionResultFromJson(json); - @override - final String testId; - final List _questionResults; - @override - List get questionResults { - if (_questionResults is EqualUnmodifiableListView) return _questionResults; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_questionResults); - } - - @override - final Duration totalTime; - @override - final int correctAnswers; - @override - final int totalQuestions; - @override - final DateTime completedAt; - - @override - String toString() { - return 'GameSessionResult(testId: $testId, questionResults: $questionResults, totalTime: $totalTime, correctAnswers: $correctAnswers, totalQuestions: $totalQuestions, completedAt: $completedAt)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$GameSessionResultImpl && - (identical(other.testId, testId) || other.testId == testId) && - const DeepCollectionEquality() - .equals(other._questionResults, _questionResults) && - (identical(other.totalTime, totalTime) || - other.totalTime == totalTime) && - (identical(other.correctAnswers, correctAnswers) || - other.correctAnswers == correctAnswers) && - (identical(other.totalQuestions, totalQuestions) || - other.totalQuestions == totalQuestions) && - (identical(other.completedAt, completedAt) || - other.completedAt == completedAt)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash( - runtimeType, - testId, - const DeepCollectionEquality().hash(_questionResults), - totalTime, - correctAnswers, - totalQuestions, - completedAt); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$GameSessionResultImplCopyWith<_$GameSessionResultImpl> get copyWith => - __$$GameSessionResultImplCopyWithImpl<_$GameSessionResultImpl>( - this, _$identity); - - @override - Map toJson() { - return _$$GameSessionResultImplToJson( - this, - ); - } +@override final String testId; + final List _questionResults; +@override List get questionResults { + if (_questionResults is EqualUnmodifiableListView) return _questionResults; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_questionResults); } -abstract class _GameSessionResult implements GameSessionResult { - const factory _GameSessionResult( - {required final String testId, - required final List questionResults, - required final Duration totalTime, - required final int correctAnswers, - required final int totalQuestions, - required final DateTime completedAt}) = _$GameSessionResultImpl; +@override final Duration totalTime; +@override final int correctAnswers; +@override final int totalQuestions; +@override final DateTime completedAt; - factory _GameSessionResult.fromJson(Map json) = - _$GameSessionResultImpl.fromJson; +/// Create a copy of GameSessionResult +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GameSessionResultCopyWith<_GameSessionResult> get copyWith => __$GameSessionResultCopyWithImpl<_GameSessionResult>(this, _$identity); - @override - String get testId; - @override - List get questionResults; - @override - Duration get totalTime; - @override - int get correctAnswers; - @override - int get totalQuestions; - @override - DateTime get completedAt; - @override - @JsonKey(ignore: true) - _$$GameSessionResultImplCopyWith<_$GameSessionResultImpl> get copyWith => - throw _privateConstructorUsedError; +@override +Map toJson() { + return _$GameSessionResultToJson(this, ); } + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GameSessionResult&&(identical(other.testId, testId) || other.testId == testId)&&const DeepCollectionEquality().equals(other._questionResults, _questionResults)&&(identical(other.totalTime, totalTime) || other.totalTime == totalTime)&&(identical(other.correctAnswers, correctAnswers) || other.correctAnswers == correctAnswers)&&(identical(other.totalQuestions, totalQuestions) || other.totalQuestions == totalQuestions)&&(identical(other.completedAt, completedAt) || other.completedAt == completedAt)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,testId,const DeepCollectionEquality().hash(_questionResults),totalTime,correctAnswers,totalQuestions,completedAt); + +@override +String toString() { + return 'GameSessionResult(testId: $testId, questionResults: $questionResults, totalTime: $totalTime, correctAnswers: $correctAnswers, totalQuestions: $totalQuestions, completedAt: $completedAt)'; +} + + +} + +/// @nodoc +abstract mixin class _$GameSessionResultCopyWith<$Res> implements $GameSessionResultCopyWith<$Res> { + factory _$GameSessionResultCopyWith(_GameSessionResult value, $Res Function(_GameSessionResult) _then) = __$GameSessionResultCopyWithImpl; +@override @useResult +$Res call({ + String testId, List questionResults, Duration totalTime, int correctAnswers, int totalQuestions, DateTime completedAt +}); + + + + +} +/// @nodoc +class __$GameSessionResultCopyWithImpl<$Res> + implements _$GameSessionResultCopyWith<$Res> { + __$GameSessionResultCopyWithImpl(this._self, this._then); + + final _GameSessionResult _self; + final $Res Function(_GameSessionResult) _then; + +/// Create a copy of GameSessionResult +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? testId = null,Object? questionResults = null,Object? totalTime = null,Object? correctAnswers = null,Object? totalQuestions = null,Object? completedAt = null,}) { + return _then(_GameSessionResult( +testId: null == testId ? _self.testId : testId // ignore: cast_nullable_to_non_nullable +as String,questionResults: null == questionResults ? _self._questionResults : questionResults // ignore: cast_nullable_to_non_nullable +as List,totalTime: null == totalTime ? _self.totalTime : totalTime // ignore: cast_nullable_to_non_nullable +as Duration,correctAnswers: null == correctAnswers ? _self.correctAnswers : correctAnswers // ignore: cast_nullable_to_non_nullable +as int,totalQuestions: null == totalQuestions ? _self.totalQuestions : totalQuestions // ignore: cast_nullable_to_non_nullable +as int,completedAt: null == completedAt ? _self.completedAt : completedAt // ignore: cast_nullable_to_non_nullable +as DateTime, + )); +} + + +} + +// dart format on diff --git a/mnemo_cards_web_v2/lib/domain/models/game_question.g.dart b/mnemo_cards_web_v2/lib/domain/models/game_question.g.dart index 40d0222..4a3ae0c 100644 --- a/mnemo_cards_web_v2/lib/domain/models/game_question.g.dart +++ b/mnemo_cards_web_v2/lib/domain/models/game_question.g.dart @@ -6,115 +6,110 @@ part of 'game_question.dart'; // JsonSerializableGenerator // ************************************************************************** -_$GameQuestionMultipleChoiceImpl _$$GameQuestionMultipleChoiceImplFromJson( - Map json) => - _$GameQuestionMultipleChoiceImpl( - MultipleChoiceQuestion.fromJson(json['question'] as Map), - $type: json['runtimeType'] as String?, - ); +GameQuestionMultipleChoice _$GameQuestionMultipleChoiceFromJson( + Map json, +) => GameQuestionMultipleChoice( + MultipleChoiceQuestion.fromJson(json['question'] as Map), + $type: json['runtimeType'] as String?, +); -Map _$$GameQuestionMultipleChoiceImplToJson( - _$GameQuestionMultipleChoiceImpl instance) => - { - 'question': instance.question, - 'runtimeType': instance.$type, - }; +Map _$GameQuestionMultipleChoiceToJson( + GameQuestionMultipleChoice instance, +) => { + 'question': instance.question, + 'runtimeType': instance.$type, +}; -_$GameQuestionInputLettersImpl _$$GameQuestionInputLettersImplFromJson( - Map json) => - _$GameQuestionInputLettersImpl( - InputLettersQuestion.fromJson(json['question'] as Map), - $type: json['runtimeType'] as String?, - ); +GameQuestionInputLetters _$GameQuestionInputLettersFromJson( + Map json, +) => GameQuestionInputLetters( + InputLettersQuestion.fromJson(json['question'] as Map), + $type: json['runtimeType'] as String?, +); -Map _$$GameQuestionInputLettersImplToJson( - _$GameQuestionInputLettersImpl instance) => - { - 'question': instance.question, - 'runtimeType': instance.$type, - }; +Map _$GameQuestionInputLettersToJson( + GameQuestionInputLetters instance, +) => { + 'question': instance.question, + 'runtimeType': instance.$type, +}; -_$GameQuestionMatchImpl _$$GameQuestionMatchImplFromJson( - Map json) => - _$GameQuestionMatchImpl( +GameQuestionMatch _$GameQuestionMatchFromJson(Map json) => + GameQuestionMatch( MatchQuestion.fromJson(json['question'] as Map), $type: json['runtimeType'] as String?, ); -Map _$$GameQuestionMatchImplToJson( - _$GameQuestionMatchImpl instance) => +Map _$GameQuestionMatchToJson(GameQuestionMatch instance) => { 'question': instance.question, 'runtimeType': instance.$type, }; -_$GameQuestionMatrixImpl _$$GameQuestionMatrixImplFromJson( - Map json) => - _$GameQuestionMatrixImpl( +GameQuestionMatrix _$GameQuestionMatrixFromJson(Map json) => + GameQuestionMatrix( MatrixQuestion.fromJson(json['question'] as Map), $type: json['runtimeType'] as String?, ); -Map _$$GameQuestionMatrixImplToJson( - _$GameQuestionMatrixImpl instance) => +Map _$GameQuestionMatrixToJson(GameQuestionMatrix instance) => { 'question': instance.question, 'runtimeType': instance.$type, }; -_$MultipleChoiceQuestionImpl _$$MultipleChoiceQuestionImplFromJson( - Map json) => - _$MultipleChoiceQuestionImpl( - id: json['id'] as String, - question: json['question'] as String, - image: json['image'] as String?, - audio: json['audio'] as String?, - options: - (json['options'] as List).map((e) => e as String).toList(), - correctAnswer: json['correctAnswer'] as String, - word: json['word'] as String, - type: json['type'] as String? ?? 'multipleChoice', - ); +_MultipleChoiceQuestion _$MultipleChoiceQuestionFromJson( + Map json, +) => _MultipleChoiceQuestion( + id: json['id'] as String, + question: json['question'] as String, + image: json['image'] as String?, + audio: json['audio'] as String?, + options: (json['options'] as List).map((e) => e as String).toList(), + correctAnswer: json['correctAnswer'] as String, + word: json['word'] as String, + type: json['type'] as String? ?? 'multipleChoice', +); -Map _$$MultipleChoiceQuestionImplToJson( - _$MultipleChoiceQuestionImpl instance) => - { - 'id': instance.id, - 'question': instance.question, - 'image': instance.image, - 'audio': instance.audio, - 'options': instance.options, - 'correctAnswer': instance.correctAnswer, - 'word': instance.word, - 'type': instance.type, - }; +Map _$MultipleChoiceQuestionToJson( + _MultipleChoiceQuestion instance, +) => { + 'id': instance.id, + 'question': instance.question, + 'image': instance.image, + 'audio': instance.audio, + 'options': instance.options, + 'correctAnswer': instance.correctAnswer, + 'word': instance.word, + 'type': instance.type, +}; -_$InputLettersQuestionImpl _$$InputLettersQuestionImplFromJson( - Map json) => - _$InputLettersQuestionImpl( - id: json['id'] as String, - template: json['template'] as String, - image: json['image'] as String?, - audio: json['audio'] as String?, - correctAnswer: json['correctAnswer'] as String, - word: json['word'] as String, - type: json['type'] as String? ?? 'inputLetters', - ); +_InputLettersQuestion _$InputLettersQuestionFromJson( + Map json, +) => _InputLettersQuestion( + id: json['id'] as String, + template: json['template'] as String, + image: json['image'] as String?, + audio: json['audio'] as String?, + correctAnswer: json['correctAnswer'] as String, + word: json['word'] as String, + type: json['type'] as String? ?? 'inputLetters', +); -Map _$$InputLettersQuestionImplToJson( - _$InputLettersQuestionImpl instance) => - { - 'id': instance.id, - 'template': instance.template, - 'image': instance.image, - 'audio': instance.audio, - 'correctAnswer': instance.correctAnswer, - 'word': instance.word, - 'type': instance.type, - }; +Map _$InputLettersQuestionToJson( + _InputLettersQuestion instance, +) => { + 'id': instance.id, + 'template': instance.template, + 'image': instance.image, + 'audio': instance.audio, + 'correctAnswer': instance.correctAnswer, + 'word': instance.word, + 'type': instance.type, +}; -_$MatchQuestionImpl _$$MatchQuestionImplFromJson(Map json) => - _$MatchQuestionImpl( +_MatchQuestion _$MatchQuestionFromJson(Map json) => + _MatchQuestion( id: json['id'] as String, question: json['question'] as String, image: json['image'] as String?, @@ -132,7 +127,7 @@ _$MatchQuestionImpl _$$MatchQuestionImplFromJson(Map json) => type: json['type'] as String? ?? 'match', ); -Map _$$MatchQuestionImplToJson(_$MatchQuestionImpl instance) => +Map _$MatchQuestionToJson(_MatchQuestion instance) => { 'id': instance.id, 'question': instance.question, @@ -145,34 +140,29 @@ Map _$$MatchQuestionImplToJson(_$MatchQuestionImpl instance) => 'type': instance.type, }; -_$MatchItemImpl _$$MatchItemImplFromJson(Map json) => - _$MatchItemImpl( - id: json['id'] as String, - text: json['text'] as String, - image: json['image'] as String?, - ); +_MatchItem _$MatchItemFromJson(Map json) => _MatchItem( + id: json['id'] as String, + text: json['text'] as String, + image: json['image'] as String?, +); -Map _$$MatchItemImplToJson(_$MatchItemImpl instance) => +Map _$MatchItemToJson(_MatchItem instance) => { 'id': instance.id, 'text': instance.text, 'image': instance.image, }; -_$MatchPairImpl _$$MatchPairImplFromJson(Map json) => - _$MatchPairImpl( - leftId: json['leftId'] as String, - rightId: json['rightId'] as String, - ); +_MatchPair _$MatchPairFromJson(Map json) => _MatchPair( + leftId: json['leftId'] as String, + rightId: json['rightId'] as String, +); -Map _$$MatchPairImplToJson(_$MatchPairImpl instance) => - { - 'leftId': instance.leftId, - 'rightId': instance.rightId, - }; +Map _$MatchPairToJson(_MatchPair instance) => + {'leftId': instance.leftId, 'rightId': instance.rightId}; -_$MatrixQuestionImpl _$$MatrixQuestionImplFromJson(Map json) => - _$MatrixQuestionImpl( +_MatrixQuestion _$MatrixQuestionFromJson(Map json) => + _MatrixQuestion( id: json['id'] as String, question: json['question'] as String, image: json['image'] as String?, @@ -190,8 +180,7 @@ _$MatrixQuestionImpl _$$MatrixQuestionImplFromJson(Map json) => type: json['type'] as String? ?? 'matrix', ); -Map _$$MatrixQuestionImplToJson( - _$MatrixQuestionImpl instance) => +Map _$MatrixQuestionToJson(_MatrixQuestion instance) => { 'id': instance.id, 'question': instance.question, @@ -204,22 +193,21 @@ Map _$$MatrixQuestionImplToJson( 'type': instance.type, }; -_$MatrixCellImpl _$$MatrixCellImplFromJson(Map json) => - _$MatrixCellImpl( - rowIndex: (json['rowIndex'] as num).toInt(), - columnIndex: (json['columnIndex'] as num).toInt(), - value: json['value'] as String, - ); +_MatrixCell _$MatrixCellFromJson(Map json) => _MatrixCell( + rowIndex: (json['rowIndex'] as num).toInt(), + columnIndex: (json['columnIndex'] as num).toInt(), + value: json['value'] as String, +); -Map _$$MatrixCellImplToJson(_$MatrixCellImpl instance) => +Map _$MatrixCellToJson(_MatrixCell instance) => { 'rowIndex': instance.rowIndex, 'columnIndex': instance.columnIndex, 'value': instance.value, }; -_$QuestionResultImpl _$$QuestionResultImplFromJson(Map json) => - _$QuestionResultImpl( +_QuestionResult _$QuestionResultFromJson(Map json) => + _QuestionResult( questionId: json['questionId'] as String, word: json['word'] as String, isCorrect: json['isCorrect'] as bool, @@ -233,8 +221,7 @@ _$QuestionResultImpl _$$QuestionResultImplFromJson(Map json) => : DateTime.parse(json['answeredAt'] as String), ); -Map _$$QuestionResultImplToJson( - _$QuestionResultImpl instance) => +Map _$QuestionResultToJson(_QuestionResult instance) => { 'questionId': instance.questionId, 'word': instance.word, @@ -245,9 +232,8 @@ Map _$$QuestionResultImplToJson( 'answeredAt': instance.answeredAt?.toIso8601String(), }; -_$GameSessionResultImpl _$$GameSessionResultImplFromJson( - Map json) => - _$GameSessionResultImpl( +_GameSessionResult _$GameSessionResultFromJson(Map json) => + _GameSessionResult( testId: json['testId'] as String, questionResults: (json['questionResults'] as List) .map((e) => QuestionResult.fromJson(e as Map)) @@ -258,8 +244,7 @@ _$GameSessionResultImpl _$$GameSessionResultImplFromJson( completedAt: DateTime.parse(json['completedAt'] as String), ); -Map _$$GameSessionResultImplToJson( - _$GameSessionResultImpl instance) => +Map _$GameSessionResultToJson(_GameSessionResult instance) => { 'testId': instance.testId, 'questionResults': instance.questionResults, diff --git a/mnemo_cards_web_v2/lib/domain/services/card_flipper_service.dart b/mnemo_cards_web_v2/lib/domain/services/card_flipper_service.dart index 39fac7d..df6ffe4 100644 --- a/mnemo_cards_web_v2/lib/domain/services/card_flipper_service.dart +++ b/mnemo_cards_web_v2/lib/domain/services/card_flipper_service.dart @@ -9,8 +9,8 @@ class CardFlipperService { /// Calculate study progress for a pack StudyProgress calculateStudyProgress({ required List cards, - required Map flippedCards, - required Map learnedCards, + required Map flippedCards, + required Map learnedCards, }) { log('Calculating study progress for ${cards.length} cards', name: 'CardFlipperService'); @@ -131,7 +131,7 @@ class CardStudyStats { required this.lastStudied, }); - final int cardId; + final String cardId; final bool isFlipped; final bool isLearned; final int viewCount; diff --git a/mnemo_cards_web_v2/lib/domain/services/http_repository_v2.dart b/mnemo_cards_web_v2/lib/domain/services/http_repository_v2.dart index ee32e6a..4283f3f 100644 --- a/mnemo_cards_web_v2/lib/domain/services/http_repository_v2.dart +++ b/mnemo_cards_web_v2/lib/domain/services/http_repository_v2.dart @@ -948,7 +948,7 @@ class HttpRepositoryV2 { } /// Get voices metadata for a specific card - Future> getCardVoices(String packId, int cardId) async { + Future> getCardVoices(String packId, String cardId) async { try { final response = await _dio.get>( ApiConfigV2.packCardVoices(packId, cardId), diff --git a/mnemo_cards_web_v2/lib/domain/services/pack_progress_service.dart b/mnemo_cards_web_v2/lib/domain/services/pack_progress_service.dart index ba6895c..8da64ea 100644 --- a/mnemo_cards_web_v2/lib/domain/services/pack_progress_service.dart +++ b/mnemo_cards_web_v2/lib/domain/services/pack_progress_service.dart @@ -63,21 +63,21 @@ class PackProgressService { } /// Mark a card as learned in a pack - Future markCardLearned(String packId, int cardId) async { + Future markCardLearned(String packId, String cardId) async { try { log('Marking card as learned: $packId/$cardId', name: 'PackProgressService'); // Get current learned cards for this pack final learnedCardsKey = '${_progressKey}_cards_$packId'; final learnedCardsList = _sharedPreferences.getStringList(learnedCardsKey) ?? []; - final learnedCards = learnedCardsList.map((e) => int.tryParse(e)).whereType().toSet(); + final learnedCards = learnedCardsList.toSet(); // Add the card if not already learned if (!learnedCards.contains(cardId)) { learnedCards.add(cardId); await _sharedPreferences.setStringList( learnedCardsKey, - learnedCards.map((e) => e.toString()).toList(), + learnedCards.toList(), ); // Update progress count @@ -94,11 +94,11 @@ class PackProgressService { } /// Check if a card is learned - bool isCardLearned(String packId, int cardId) { + bool isCardLearned(String packId, String cardId) { try { final learnedCardsKey = '${_progressKey}_cards_$packId'; final learnedCardsList = _sharedPreferences.getStringList(learnedCardsKey) ?? []; - final learnedCards = learnedCardsList.map((e) => int.tryParse(e)).whereType().toSet(); + final learnedCards = learnedCardsList.toSet(); return learnedCards.contains(cardId); } catch (e, s) { log( @@ -112,11 +112,11 @@ class PackProgressService { } /// Get all learned cards for a pack - Set getLearnedCards(String packId) { + Set getLearnedCards(String packId) { try { final learnedCardsKey = '${_progressKey}_cards_$packId'; final learnedCardsList = _sharedPreferences.getStringList(learnedCardsKey) ?? []; - return learnedCardsList.map((e) => int.tryParse(e)).whereType().toSet(); + return learnedCardsList.toSet(); } catch (e, s) { log( 'Error getting learned cards', diff --git a/mnemo_cards_web_v2/lib/domain/state/ads_reward_state_manager.freezed.dart b/mnemo_cards_web_v2/lib/domain/state/ads_reward_state_manager.freezed.dart index 6c968c5..cb38538 100644 --- a/mnemo_cards_web_v2/lib/domain/state/ads_reward_state_manager.freezed.dart +++ b/mnemo_cards_web_v2/lib/domain/state/ads_reward_state_manager.freezed.dart @@ -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,1229 +9,632 @@ part of 'ads_reward_state_manager.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - /// @nodoc mixin _$AdsRewardState { - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(String packId) loading, - required TResult Function(String packId) notAvailable, - required TResult Function(AdsRewardOffer offer) ready, - required TResult Function(AdsRewardOffer offer) claiming, - required TResult Function(AdsRewardOffer offer) success, - required TResult Function(String message, AdsRewardOffer? previousOffer) - error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(String packId)? loading, - TResult? Function(String packId)? notAvailable, - TResult? Function(AdsRewardOffer offer)? ready, - TResult? Function(AdsRewardOffer offer)? claiming, - TResult? Function(AdsRewardOffer offer)? success, - TResult? Function(String message, AdsRewardOffer? previousOffer)? error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(String packId)? loading, - TResult Function(String packId)? notAvailable, - TResult Function(AdsRewardOffer offer)? ready, - TResult Function(AdsRewardOffer offer)? claiming, - TResult Function(AdsRewardOffer offer)? success, - TResult Function(String message, AdsRewardOffer? previousOffer)? error, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_NotAvailable value) notAvailable, - required TResult Function(_Ready value) ready, - required TResult Function(_Claiming value) claiming, - required TResult Function(_Success value) success, - required TResult Function(_Error value) error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_NotAvailable value)? notAvailable, - TResult? Function(_Ready value)? ready, - TResult? Function(_Claiming value)? claiming, - TResult? Function(_Success value)? success, - TResult? Function(_Error value)? error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_NotAvailable value)? notAvailable, - TResult Function(_Ready value)? ready, - TResult Function(_Claiming value)? claiming, - TResult Function(_Success value)? success, - TResult Function(_Error value)? error, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; + + + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AdsRewardState); +} + + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'AdsRewardState()'; +} + + } /// @nodoc -abstract class $AdsRewardStateCopyWith<$Res> { - factory $AdsRewardStateCopyWith( - AdsRewardState value, $Res Function(AdsRewardState) then) = - _$AdsRewardStateCopyWithImpl<$Res, AdsRewardState>; +class $AdsRewardStateCopyWith<$Res> { +$AdsRewardStateCopyWith(AdsRewardState _, $Res Function(AdsRewardState) __); } -/// @nodoc -class _$AdsRewardStateCopyWithImpl<$Res, $Val extends AdsRewardState> - implements $AdsRewardStateCopyWith<$Res> { - _$AdsRewardStateCopyWithImpl(this._value, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; +/// Adds pattern-matching-related methods to [AdsRewardState]. +extension AdsRewardStatePatterns on AdsRewardState { +/// 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 Function( _Initial value)? initial,TResult Function( _Loading value)? loading,TResult Function( _NotAvailable value)? notAvailable,TResult Function( _Ready value)? ready,TResult Function( _Claiming value)? claiming,TResult Function( _Success value)? success,TResult Function( _Error value)? error,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial(_that);case _Loading() when loading != null: +return loading(_that);case _NotAvailable() when notAvailable != null: +return notAvailable(_that);case _Ready() when ready != null: +return ready(_that);case _Claiming() when claiming != null: +return claiming(_that);case _Success() when success != null: +return success(_that);case _Error() when error != null: +return error(_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({required TResult Function( _Initial value) initial,required TResult Function( _Loading value) loading,required TResult Function( _NotAvailable value) notAvailable,required TResult Function( _Ready value) ready,required TResult Function( _Claiming value) claiming,required TResult Function( _Success value) success,required TResult Function( _Error value) error,}){ +final _that = this; +switch (_that) { +case _Initial(): +return initial(_that);case _Loading(): +return loading(_that);case _NotAvailable(): +return notAvailable(_that);case _Ready(): +return ready(_that);case _Claiming(): +return claiming(_that);case _Success(): +return success(_that);case _Error(): +return error(_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? Function( _Initial value)? initial,TResult? Function( _Loading value)? loading,TResult? Function( _NotAvailable value)? notAvailable,TResult? Function( _Ready value)? ready,TResult? Function( _Claiming value)? claiming,TResult? Function( _Success value)? success,TResult? Function( _Error value)? error,}){ +final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial(_that);case _Loading() when loading != null: +return loading(_that);case _NotAvailable() when notAvailable != null: +return notAvailable(_that);case _Ready() when ready != null: +return ready(_that);case _Claiming() when claiming != null: +return claiming(_that);case _Success() when success != null: +return success(_that);case _Error() when error != null: +return error(_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 Function()? initial,TResult Function( String packId)? loading,TResult Function( String packId)? notAvailable,TResult Function( AdsRewardOffer offer)? ready,TResult Function( AdsRewardOffer offer)? claiming,TResult Function( AdsRewardOffer offer)? success,TResult Function( String message, AdsRewardOffer? previousOffer)? error,required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial();case _Loading() when loading != null: +return loading(_that.packId);case _NotAvailable() when notAvailable != null: +return notAvailable(_that.packId);case _Ready() when ready != null: +return ready(_that.offer);case _Claiming() when claiming != null: +return claiming(_that.offer);case _Success() when success != null: +return success(_that.offer);case _Error() when error != null: +return error(_that.message,_that.previousOffer);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({required TResult Function() initial,required TResult Function( String packId) loading,required TResult Function( String packId) notAvailable,required TResult Function( AdsRewardOffer offer) ready,required TResult Function( AdsRewardOffer offer) claiming,required TResult Function( AdsRewardOffer offer) success,required TResult Function( String message, AdsRewardOffer? previousOffer) error,}) {final _that = this; +switch (_that) { +case _Initial(): +return initial();case _Loading(): +return loading(_that.packId);case _NotAvailable(): +return notAvailable(_that.packId);case _Ready(): +return ready(_that.offer);case _Claiming(): +return claiming(_that.offer);case _Success(): +return success(_that.offer);case _Error(): +return error(_that.message,_that.previousOffer);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? Function()? initial,TResult? Function( String packId)? loading,TResult? Function( String packId)? notAvailable,TResult? Function( AdsRewardOffer offer)? ready,TResult? Function( AdsRewardOffer offer)? claiming,TResult? Function( AdsRewardOffer offer)? success,TResult? Function( String message, AdsRewardOffer? previousOffer)? error,}) {final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial();case _Loading() when loading != null: +return loading(_that.packId);case _NotAvailable() when notAvailable != null: +return notAvailable(_that.packId);case _Ready() when ready != null: +return ready(_that.offer);case _Claiming() when claiming != null: +return claiming(_that.offer);case _Success() when success != null: +return success(_that.offer);case _Error() when error != null: +return error(_that.message,_that.previousOffer);case _: + return null; + +} } -/// @nodoc -abstract class _$$InitialImplCopyWith<$Res> { - factory _$$InitialImplCopyWith( - _$InitialImpl value, $Res Function(_$InitialImpl) then) = - __$$InitialImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$InitialImplCopyWithImpl<$Res> - extends _$AdsRewardStateCopyWithImpl<$Res, _$InitialImpl> - implements _$$InitialImplCopyWith<$Res> { - __$$InitialImplCopyWithImpl( - _$InitialImpl _value, $Res Function(_$InitialImpl) _then) - : super(_value, _then); } /// @nodoc -class _$InitialImpl implements _Initial { - const _$InitialImpl(); - @override - String toString() { - return 'AdsRewardState.initial()'; - } +class _Initial implements AdsRewardState { + const _Initial(); + - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$InitialImpl); - } - @override - int get hashCode => runtimeType.hashCode; - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(String packId) loading, - required TResult Function(String packId) notAvailable, - required TResult Function(AdsRewardOffer offer) ready, - required TResult Function(AdsRewardOffer offer) claiming, - required TResult Function(AdsRewardOffer offer) success, - required TResult Function(String message, AdsRewardOffer? previousOffer) - error, - }) { - return initial(); - } - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(String packId)? loading, - TResult? Function(String packId)? notAvailable, - TResult? Function(AdsRewardOffer offer)? ready, - TResult? Function(AdsRewardOffer offer)? claiming, - TResult? Function(AdsRewardOffer offer)? success, - TResult? Function(String message, AdsRewardOffer? previousOffer)? error, - }) { - return initial?.call(); - } - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(String packId)? loading, - TResult Function(String packId)? notAvailable, - TResult Function(AdsRewardOffer offer)? ready, - TResult Function(AdsRewardOffer offer)? claiming, - TResult Function(AdsRewardOffer offer)? success, - TResult Function(String message, AdsRewardOffer? previousOffer)? error, - required TResult orElse(), - }) { - if (initial != null) { - return initial(); - } - return orElse(); - } - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_NotAvailable value) notAvailable, - required TResult Function(_Ready value) ready, - required TResult Function(_Claiming value) claiming, - required TResult Function(_Success value) success, - required TResult Function(_Error value) error, - }) { - return initial(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_NotAvailable value)? notAvailable, - TResult? Function(_Ready value)? ready, - TResult? Function(_Claiming value)? claiming, - TResult? Function(_Success value)? success, - TResult? Function(_Error value)? error, - }) { - return initial?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_NotAvailable value)? notAvailable, - TResult Function(_Ready value)? ready, - TResult Function(_Claiming value)? claiming, - TResult Function(_Success value)? success, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (initial != null) { - return initial(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Initial); } -abstract class _Initial implements AdsRewardState { - const factory _Initial() = _$InitialImpl; + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'AdsRewardState.initial()'; +} + + +} + + + + +/// @nodoc + + +class _Loading implements AdsRewardState { + const _Loading({required this.packId}); + + + final String packId; + +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LoadingCopyWith<_Loading> get copyWith => __$LoadingCopyWithImpl<_Loading>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loading&&(identical(other.packId, packId) || other.packId == packId)); +} + + +@override +int get hashCode => Object.hash(runtimeType,packId); + +@override +String toString() { + return 'AdsRewardState.loading(packId: $packId)'; +} + + } /// @nodoc -abstract class _$$LoadingImplCopyWith<$Res> { - factory _$$LoadingImplCopyWith( - _$LoadingImpl value, $Res Function(_$LoadingImpl) then) = - __$$LoadingImplCopyWithImpl<$Res>; - @useResult - $Res call({String packId}); +abstract mixin class _$LoadingCopyWith<$Res> implements $AdsRewardStateCopyWith<$Res> { + factory _$LoadingCopyWith(_Loading value, $Res Function(_Loading) _then) = __$LoadingCopyWithImpl; +@useResult +$Res call({ + String packId +}); + + + + +} +/// @nodoc +class __$LoadingCopyWithImpl<$Res> + implements _$LoadingCopyWith<$Res> { + __$LoadingCopyWithImpl(this._self, this._then); + + final _Loading _self; + final $Res Function(_Loading) _then; + +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? packId = null,}) { + return _then(_Loading( +packId: null == packId ? _self.packId : packId // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -class __$$LoadingImplCopyWithImpl<$Res> - extends _$AdsRewardStateCopyWithImpl<$Res, _$LoadingImpl> - implements _$$LoadingImplCopyWith<$Res> { - __$$LoadingImplCopyWithImpl( - _$LoadingImpl _value, $Res Function(_$LoadingImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? packId = null, - }) { - return _then(_$LoadingImpl( - packId: null == packId - ? _value.packId - : packId // ignore: cast_nullable_to_non_nullable - as String, - )); - } } /// @nodoc -class _$LoadingImpl implements _Loading { - const _$LoadingImpl({required this.packId}); - @override - final String packId; +class _NotAvailable implements AdsRewardState { + const _NotAvailable({required this.packId}); + - @override - String toString() { - return 'AdsRewardState.loading(packId: $packId)'; - } + final String packId; - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$LoadingImpl && - (identical(other.packId, packId) || other.packId == packId)); - } +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$NotAvailableCopyWith<_NotAvailable> get copyWith => __$NotAvailableCopyWithImpl<_NotAvailable>(this, _$identity); - @override - int get hashCode => Object.hash(runtimeType, packId); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$LoadingImplCopyWith<_$LoadingImpl> get copyWith => - __$$LoadingImplCopyWithImpl<_$LoadingImpl>(this, _$identity); - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(String packId) loading, - required TResult Function(String packId) notAvailable, - required TResult Function(AdsRewardOffer offer) ready, - required TResult Function(AdsRewardOffer offer) claiming, - required TResult Function(AdsRewardOffer offer) success, - required TResult Function(String message, AdsRewardOffer? previousOffer) - error, - }) { - return loading(packId); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(String packId)? loading, - TResult? Function(String packId)? notAvailable, - TResult? Function(AdsRewardOffer offer)? ready, - TResult? Function(AdsRewardOffer offer)? claiming, - TResult? Function(AdsRewardOffer offer)? success, - TResult? Function(String message, AdsRewardOffer? previousOffer)? error, - }) { - return loading?.call(packId); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(String packId)? loading, - TResult Function(String packId)? notAvailable, - TResult Function(AdsRewardOffer offer)? ready, - TResult Function(AdsRewardOffer offer)? claiming, - TResult Function(AdsRewardOffer offer)? success, - TResult Function(String message, AdsRewardOffer? previousOffer)? error, - required TResult orElse(), - }) { - if (loading != null) { - return loading(packId); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_NotAvailable value) notAvailable, - required TResult Function(_Ready value) ready, - required TResult Function(_Claiming value) claiming, - required TResult Function(_Success value) success, - required TResult Function(_Error value) error, - }) { - return loading(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_NotAvailable value)? notAvailable, - TResult? Function(_Ready value)? ready, - TResult? Function(_Claiming value)? claiming, - TResult? Function(_Success value)? success, - TResult? Function(_Error value)? error, - }) { - return loading?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_NotAvailable value)? notAvailable, - TResult Function(_Ready value)? ready, - TResult Function(_Claiming value)? claiming, - TResult Function(_Success value)? success, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (loading != null) { - return loading(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _NotAvailable&&(identical(other.packId, packId) || other.packId == packId)); +} + + +@override +int get hashCode => Object.hash(runtimeType,packId); + +@override +String toString() { + return 'AdsRewardState.notAvailable(packId: $packId)'; } -abstract class _Loading implements AdsRewardState { - const factory _Loading({required final String packId}) = _$LoadingImpl; - String get packId; - @JsonKey(ignore: true) - _$$LoadingImplCopyWith<_$LoadingImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$NotAvailableImplCopyWith<$Res> { - factory _$$NotAvailableImplCopyWith( - _$NotAvailableImpl value, $Res Function(_$NotAvailableImpl) then) = - __$$NotAvailableImplCopyWithImpl<$Res>; - @useResult - $Res call({String packId}); +abstract mixin class _$NotAvailableCopyWith<$Res> implements $AdsRewardStateCopyWith<$Res> { + factory _$NotAvailableCopyWith(_NotAvailable value, $Res Function(_NotAvailable) _then) = __$NotAvailableCopyWithImpl; +@useResult +$Res call({ + String packId +}); + + + + +} +/// @nodoc +class __$NotAvailableCopyWithImpl<$Res> + implements _$NotAvailableCopyWith<$Res> { + __$NotAvailableCopyWithImpl(this._self, this._then); + + final _NotAvailable _self; + final $Res Function(_NotAvailable) _then; + +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? packId = null,}) { + return _then(_NotAvailable( +packId: null == packId ? _self.packId : packId // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -class __$$NotAvailableImplCopyWithImpl<$Res> - extends _$AdsRewardStateCopyWithImpl<$Res, _$NotAvailableImpl> - implements _$$NotAvailableImplCopyWith<$Res> { - __$$NotAvailableImplCopyWithImpl( - _$NotAvailableImpl _value, $Res Function(_$NotAvailableImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? packId = null, - }) { - return _then(_$NotAvailableImpl( - packId: null == packId - ? _value.packId - : packId // ignore: cast_nullable_to_non_nullable - as String, - )); - } } /// @nodoc -class _$NotAvailableImpl implements _NotAvailable { - const _$NotAvailableImpl({required this.packId}); - @override - final String packId; +class _Ready implements AdsRewardState { + const _Ready({required this.offer}); + - @override - String toString() { - return 'AdsRewardState.notAvailable(packId: $packId)'; - } + final AdsRewardOffer offer; - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$NotAvailableImpl && - (identical(other.packId, packId) || other.packId == packId)); - } +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ReadyCopyWith<_Ready> get copyWith => __$ReadyCopyWithImpl<_Ready>(this, _$identity); - @override - int get hashCode => Object.hash(runtimeType, packId); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$NotAvailableImplCopyWith<_$NotAvailableImpl> get copyWith => - __$$NotAvailableImplCopyWithImpl<_$NotAvailableImpl>(this, _$identity); - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(String packId) loading, - required TResult Function(String packId) notAvailable, - required TResult Function(AdsRewardOffer offer) ready, - required TResult Function(AdsRewardOffer offer) claiming, - required TResult Function(AdsRewardOffer offer) success, - required TResult Function(String message, AdsRewardOffer? previousOffer) - error, - }) { - return notAvailable(packId); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(String packId)? loading, - TResult? Function(String packId)? notAvailable, - TResult? Function(AdsRewardOffer offer)? ready, - TResult? Function(AdsRewardOffer offer)? claiming, - TResult? Function(AdsRewardOffer offer)? success, - TResult? Function(String message, AdsRewardOffer? previousOffer)? error, - }) { - return notAvailable?.call(packId); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(String packId)? loading, - TResult Function(String packId)? notAvailable, - TResult Function(AdsRewardOffer offer)? ready, - TResult Function(AdsRewardOffer offer)? claiming, - TResult Function(AdsRewardOffer offer)? success, - TResult Function(String message, AdsRewardOffer? previousOffer)? error, - required TResult orElse(), - }) { - if (notAvailable != null) { - return notAvailable(packId); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_NotAvailable value) notAvailable, - required TResult Function(_Ready value) ready, - required TResult Function(_Claiming value) claiming, - required TResult Function(_Success value) success, - required TResult Function(_Error value) error, - }) { - return notAvailable(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_NotAvailable value)? notAvailable, - TResult? Function(_Ready value)? ready, - TResult? Function(_Claiming value)? claiming, - TResult? Function(_Success value)? success, - TResult? Function(_Error value)? error, - }) { - return notAvailable?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_NotAvailable value)? notAvailable, - TResult Function(_Ready value)? ready, - TResult Function(_Claiming value)? claiming, - TResult Function(_Success value)? success, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (notAvailable != null) { - return notAvailable(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Ready&&(identical(other.offer, offer) || other.offer == offer)); +} + + +@override +int get hashCode => Object.hash(runtimeType,offer); + +@override +String toString() { + return 'AdsRewardState.ready(offer: $offer)'; } -abstract class _NotAvailable implements AdsRewardState { - const factory _NotAvailable({required final String packId}) = - _$NotAvailableImpl; - String get packId; - @JsonKey(ignore: true) - _$$NotAvailableImplCopyWith<_$NotAvailableImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$ReadyImplCopyWith<$Res> { - factory _$$ReadyImplCopyWith( - _$ReadyImpl value, $Res Function(_$ReadyImpl) then) = - __$$ReadyImplCopyWithImpl<$Res>; - @useResult - $Res call({AdsRewardOffer offer}); +abstract mixin class _$ReadyCopyWith<$Res> implements $AdsRewardStateCopyWith<$Res> { + factory _$ReadyCopyWith(_Ready value, $Res Function(_Ready) _then) = __$ReadyCopyWithImpl; +@useResult +$Res call({ + AdsRewardOffer offer +}); + + + + +} +/// @nodoc +class __$ReadyCopyWithImpl<$Res> + implements _$ReadyCopyWith<$Res> { + __$ReadyCopyWithImpl(this._self, this._then); + + final _Ready _self; + final $Res Function(_Ready) _then; + +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? offer = null,}) { + return _then(_Ready( +offer: null == offer ? _self.offer : offer // ignore: cast_nullable_to_non_nullable +as AdsRewardOffer, + )); } -/// @nodoc -class __$$ReadyImplCopyWithImpl<$Res> - extends _$AdsRewardStateCopyWithImpl<$Res, _$ReadyImpl> - implements _$$ReadyImplCopyWith<$Res> { - __$$ReadyImplCopyWithImpl( - _$ReadyImpl _value, $Res Function(_$ReadyImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? offer = null, - }) { - return _then(_$ReadyImpl( - offer: null == offer - ? _value.offer - : offer // ignore: cast_nullable_to_non_nullable - as AdsRewardOffer, - )); - } } /// @nodoc -class _$ReadyImpl implements _Ready { - const _$ReadyImpl({required this.offer}); - @override - final AdsRewardOffer offer; +class _Claiming implements AdsRewardState { + const _Claiming({required this.offer}); + - @override - String toString() { - return 'AdsRewardState.ready(offer: $offer)'; - } + final AdsRewardOffer offer; - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ReadyImpl && - (identical(other.offer, offer) || other.offer == offer)); - } +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ClaimingCopyWith<_Claiming> get copyWith => __$ClaimingCopyWithImpl<_Claiming>(this, _$identity); - @override - int get hashCode => Object.hash(runtimeType, offer); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$ReadyImplCopyWith<_$ReadyImpl> get copyWith => - __$$ReadyImplCopyWithImpl<_$ReadyImpl>(this, _$identity); - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(String packId) loading, - required TResult Function(String packId) notAvailable, - required TResult Function(AdsRewardOffer offer) ready, - required TResult Function(AdsRewardOffer offer) claiming, - required TResult Function(AdsRewardOffer offer) success, - required TResult Function(String message, AdsRewardOffer? previousOffer) - error, - }) { - return ready(offer); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(String packId)? loading, - TResult? Function(String packId)? notAvailable, - TResult? Function(AdsRewardOffer offer)? ready, - TResult? Function(AdsRewardOffer offer)? claiming, - TResult? Function(AdsRewardOffer offer)? success, - TResult? Function(String message, AdsRewardOffer? previousOffer)? error, - }) { - return ready?.call(offer); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(String packId)? loading, - TResult Function(String packId)? notAvailable, - TResult Function(AdsRewardOffer offer)? ready, - TResult Function(AdsRewardOffer offer)? claiming, - TResult Function(AdsRewardOffer offer)? success, - TResult Function(String message, AdsRewardOffer? previousOffer)? error, - required TResult orElse(), - }) { - if (ready != null) { - return ready(offer); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_NotAvailable value) notAvailable, - required TResult Function(_Ready value) ready, - required TResult Function(_Claiming value) claiming, - required TResult Function(_Success value) success, - required TResult Function(_Error value) error, - }) { - return ready(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_NotAvailable value)? notAvailable, - TResult? Function(_Ready value)? ready, - TResult? Function(_Claiming value)? claiming, - TResult? Function(_Success value)? success, - TResult? Function(_Error value)? error, - }) { - return ready?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_NotAvailable value)? notAvailable, - TResult Function(_Ready value)? ready, - TResult Function(_Claiming value)? claiming, - TResult Function(_Success value)? success, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (ready != null) { - return ready(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Claiming&&(identical(other.offer, offer) || other.offer == offer)); +} + + +@override +int get hashCode => Object.hash(runtimeType,offer); + +@override +String toString() { + return 'AdsRewardState.claiming(offer: $offer)'; } -abstract class _Ready implements AdsRewardState { - const factory _Ready({required final AdsRewardOffer offer}) = _$ReadyImpl; - AdsRewardOffer get offer; - @JsonKey(ignore: true) - _$$ReadyImplCopyWith<_$ReadyImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$ClaimingImplCopyWith<$Res> { - factory _$$ClaimingImplCopyWith( - _$ClaimingImpl value, $Res Function(_$ClaimingImpl) then) = - __$$ClaimingImplCopyWithImpl<$Res>; - @useResult - $Res call({AdsRewardOffer offer}); +abstract mixin class _$ClaimingCopyWith<$Res> implements $AdsRewardStateCopyWith<$Res> { + factory _$ClaimingCopyWith(_Claiming value, $Res Function(_Claiming) _then) = __$ClaimingCopyWithImpl; +@useResult +$Res call({ + AdsRewardOffer offer +}); + + + + +} +/// @nodoc +class __$ClaimingCopyWithImpl<$Res> + implements _$ClaimingCopyWith<$Res> { + __$ClaimingCopyWithImpl(this._self, this._then); + + final _Claiming _self; + final $Res Function(_Claiming) _then; + +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? offer = null,}) { + return _then(_Claiming( +offer: null == offer ? _self.offer : offer // ignore: cast_nullable_to_non_nullable +as AdsRewardOffer, + )); } -/// @nodoc -class __$$ClaimingImplCopyWithImpl<$Res> - extends _$AdsRewardStateCopyWithImpl<$Res, _$ClaimingImpl> - implements _$$ClaimingImplCopyWith<$Res> { - __$$ClaimingImplCopyWithImpl( - _$ClaimingImpl _value, $Res Function(_$ClaimingImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? offer = null, - }) { - return _then(_$ClaimingImpl( - offer: null == offer - ? _value.offer - : offer // ignore: cast_nullable_to_non_nullable - as AdsRewardOffer, - )); - } } /// @nodoc -class _$ClaimingImpl implements _Claiming { - const _$ClaimingImpl({required this.offer}); - @override - final AdsRewardOffer offer; +class _Success implements AdsRewardState { + const _Success({required this.offer}); + - @override - String toString() { - return 'AdsRewardState.claiming(offer: $offer)'; - } + final AdsRewardOffer offer; - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ClaimingImpl && - (identical(other.offer, offer) || other.offer == offer)); - } +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SuccessCopyWith<_Success> get copyWith => __$SuccessCopyWithImpl<_Success>(this, _$identity); - @override - int get hashCode => Object.hash(runtimeType, offer); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$ClaimingImplCopyWith<_$ClaimingImpl> get copyWith => - __$$ClaimingImplCopyWithImpl<_$ClaimingImpl>(this, _$identity); - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(String packId) loading, - required TResult Function(String packId) notAvailable, - required TResult Function(AdsRewardOffer offer) ready, - required TResult Function(AdsRewardOffer offer) claiming, - required TResult Function(AdsRewardOffer offer) success, - required TResult Function(String message, AdsRewardOffer? previousOffer) - error, - }) { - return claiming(offer); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(String packId)? loading, - TResult? Function(String packId)? notAvailable, - TResult? Function(AdsRewardOffer offer)? ready, - TResult? Function(AdsRewardOffer offer)? claiming, - TResult? Function(AdsRewardOffer offer)? success, - TResult? Function(String message, AdsRewardOffer? previousOffer)? error, - }) { - return claiming?.call(offer); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(String packId)? loading, - TResult Function(String packId)? notAvailable, - TResult Function(AdsRewardOffer offer)? ready, - TResult Function(AdsRewardOffer offer)? claiming, - TResult Function(AdsRewardOffer offer)? success, - TResult Function(String message, AdsRewardOffer? previousOffer)? error, - required TResult orElse(), - }) { - if (claiming != null) { - return claiming(offer); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_NotAvailable value) notAvailable, - required TResult Function(_Ready value) ready, - required TResult Function(_Claiming value) claiming, - required TResult Function(_Success value) success, - required TResult Function(_Error value) error, - }) { - return claiming(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_NotAvailable value)? notAvailable, - TResult? Function(_Ready value)? ready, - TResult? Function(_Claiming value)? claiming, - TResult? Function(_Success value)? success, - TResult? Function(_Error value)? error, - }) { - return claiming?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_NotAvailable value)? notAvailable, - TResult Function(_Ready value)? ready, - TResult Function(_Claiming value)? claiming, - TResult Function(_Success value)? success, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (claiming != null) { - return claiming(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Success&&(identical(other.offer, offer) || other.offer == offer)); +} + + +@override +int get hashCode => Object.hash(runtimeType,offer); + +@override +String toString() { + return 'AdsRewardState.success(offer: $offer)'; } -abstract class _Claiming implements AdsRewardState { - const factory _Claiming({required final AdsRewardOffer offer}) = - _$ClaimingImpl; - AdsRewardOffer get offer; - @JsonKey(ignore: true) - _$$ClaimingImplCopyWith<_$ClaimingImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$SuccessImplCopyWith<$Res> { - factory _$$SuccessImplCopyWith( - _$SuccessImpl value, $Res Function(_$SuccessImpl) then) = - __$$SuccessImplCopyWithImpl<$Res>; - @useResult - $Res call({AdsRewardOffer offer}); +abstract mixin class _$SuccessCopyWith<$Res> implements $AdsRewardStateCopyWith<$Res> { + factory _$SuccessCopyWith(_Success value, $Res Function(_Success) _then) = __$SuccessCopyWithImpl; +@useResult +$Res call({ + AdsRewardOffer offer +}); + + + + +} +/// @nodoc +class __$SuccessCopyWithImpl<$Res> + implements _$SuccessCopyWith<$Res> { + __$SuccessCopyWithImpl(this._self, this._then); + + final _Success _self; + final $Res Function(_Success) _then; + +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? offer = null,}) { + return _then(_Success( +offer: null == offer ? _self.offer : offer // ignore: cast_nullable_to_non_nullable +as AdsRewardOffer, + )); } -/// @nodoc -class __$$SuccessImplCopyWithImpl<$Res> - extends _$AdsRewardStateCopyWithImpl<$Res, _$SuccessImpl> - implements _$$SuccessImplCopyWith<$Res> { - __$$SuccessImplCopyWithImpl( - _$SuccessImpl _value, $Res Function(_$SuccessImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? offer = null, - }) { - return _then(_$SuccessImpl( - offer: null == offer - ? _value.offer - : offer // ignore: cast_nullable_to_non_nullable - as AdsRewardOffer, - )); - } } /// @nodoc -class _$SuccessImpl implements _Success { - const _$SuccessImpl({required this.offer}); - @override - final AdsRewardOffer offer; +class _Error implements AdsRewardState { + const _Error({required this.message, this.previousOffer}); + - @override - String toString() { - return 'AdsRewardState.success(offer: $offer)'; - } + final String message; + final AdsRewardOffer? previousOffer; - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$SuccessImpl && - (identical(other.offer, offer) || other.offer == offer)); - } +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ErrorCopyWith<_Error> get copyWith => __$ErrorCopyWithImpl<_Error>(this, _$identity); - @override - int get hashCode => Object.hash(runtimeType, offer); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$SuccessImplCopyWith<_$SuccessImpl> get copyWith => - __$$SuccessImplCopyWithImpl<_$SuccessImpl>(this, _$identity); - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(String packId) loading, - required TResult Function(String packId) notAvailable, - required TResult Function(AdsRewardOffer offer) ready, - required TResult Function(AdsRewardOffer offer) claiming, - required TResult Function(AdsRewardOffer offer) success, - required TResult Function(String message, AdsRewardOffer? previousOffer) - error, - }) { - return success(offer); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(String packId)? loading, - TResult? Function(String packId)? notAvailable, - TResult? Function(AdsRewardOffer offer)? ready, - TResult? Function(AdsRewardOffer offer)? claiming, - TResult? Function(AdsRewardOffer offer)? success, - TResult? Function(String message, AdsRewardOffer? previousOffer)? error, - }) { - return success?.call(offer); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(String packId)? loading, - TResult Function(String packId)? notAvailable, - TResult Function(AdsRewardOffer offer)? ready, - TResult Function(AdsRewardOffer offer)? claiming, - TResult Function(AdsRewardOffer offer)? success, - TResult Function(String message, AdsRewardOffer? previousOffer)? error, - required TResult orElse(), - }) { - if (success != null) { - return success(offer); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_NotAvailable value) notAvailable, - required TResult Function(_Ready value) ready, - required TResult Function(_Claiming value) claiming, - required TResult Function(_Success value) success, - required TResult Function(_Error value) error, - }) { - return success(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_NotAvailable value)? notAvailable, - TResult? Function(_Ready value)? ready, - TResult? Function(_Claiming value)? claiming, - TResult? Function(_Success value)? success, - TResult? Function(_Error value)? error, - }) { - return success?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_NotAvailable value)? notAvailable, - TResult Function(_Ready value)? ready, - TResult Function(_Claiming value)? claiming, - TResult Function(_Success value)? success, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (success != null) { - return success(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Error&&(identical(other.message, message) || other.message == message)&&(identical(other.previousOffer, previousOffer) || other.previousOffer == previousOffer)); +} + + +@override +int get hashCode => Object.hash(runtimeType,message,previousOffer); + +@override +String toString() { + return 'AdsRewardState.error(message: $message, previousOffer: $previousOffer)'; } -abstract class _Success implements AdsRewardState { - const factory _Success({required final AdsRewardOffer offer}) = _$SuccessImpl; - AdsRewardOffer get offer; - @JsonKey(ignore: true) - _$$SuccessImplCopyWith<_$SuccessImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$ErrorImplCopyWith<$Res> { - factory _$$ErrorImplCopyWith( - _$ErrorImpl value, $Res Function(_$ErrorImpl) then) = - __$$ErrorImplCopyWithImpl<$Res>; - @useResult - $Res call({String message, AdsRewardOffer? previousOffer}); -} +abstract mixin class _$ErrorCopyWith<$Res> implements $AdsRewardStateCopyWith<$Res> { + factory _$ErrorCopyWith(_Error value, $Res Function(_Error) _then) = __$ErrorCopyWithImpl; +@useResult +$Res call({ + String message, AdsRewardOffer? previousOffer +}); + + + +} /// @nodoc -class __$$ErrorImplCopyWithImpl<$Res> - extends _$AdsRewardStateCopyWithImpl<$Res, _$ErrorImpl> - implements _$$ErrorImplCopyWith<$Res> { - __$$ErrorImplCopyWithImpl( - _$ErrorImpl _value, $Res Function(_$ErrorImpl) _then) - : super(_value, _then); +class __$ErrorCopyWithImpl<$Res> + implements _$ErrorCopyWith<$Res> { + __$ErrorCopyWithImpl(this._self, this._then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? message = null, - Object? previousOffer = freezed, - }) { - return _then(_$ErrorImpl( - message: null == message - ? _value.message - : message // ignore: cast_nullable_to_non_nullable - as String, - previousOffer: freezed == previousOffer - ? _value.previousOffer - : previousOffer // ignore: cast_nullable_to_non_nullable - as AdsRewardOffer?, - )); - } + final _Error _self; + final $Res Function(_Error) _then; + +/// Create a copy of AdsRewardState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? message = null,Object? previousOffer = freezed,}) { + return _then(_Error( +message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String,previousOffer: freezed == previousOffer ? _self.previousOffer : previousOffer // ignore: cast_nullable_to_non_nullable +as AdsRewardOffer?, + )); } -/// @nodoc -class _$ErrorImpl implements _Error { - const _$ErrorImpl({required this.message, this.previousOffer}); - - @override - final String message; - @override - final AdsRewardOffer? previousOffer; - - @override - String toString() { - return 'AdsRewardState.error(message: $message, previousOffer: $previousOffer)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ErrorImpl && - (identical(other.message, message) || other.message == message) && - (identical(other.previousOffer, previousOffer) || - other.previousOffer == previousOffer)); - } - - @override - int get hashCode => Object.hash(runtimeType, message, previousOffer); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => - __$$ErrorImplCopyWithImpl<_$ErrorImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(String packId) loading, - required TResult Function(String packId) notAvailable, - required TResult Function(AdsRewardOffer offer) ready, - required TResult Function(AdsRewardOffer offer) claiming, - required TResult Function(AdsRewardOffer offer) success, - required TResult Function(String message, AdsRewardOffer? previousOffer) - error, - }) { - return error(message, previousOffer); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(String packId)? loading, - TResult? Function(String packId)? notAvailable, - TResult? Function(AdsRewardOffer offer)? ready, - TResult? Function(AdsRewardOffer offer)? claiming, - TResult? Function(AdsRewardOffer offer)? success, - TResult? Function(String message, AdsRewardOffer? previousOffer)? error, - }) { - return error?.call(message, previousOffer); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(String packId)? loading, - TResult Function(String packId)? notAvailable, - TResult Function(AdsRewardOffer offer)? ready, - TResult Function(AdsRewardOffer offer)? claiming, - TResult Function(AdsRewardOffer offer)? success, - TResult Function(String message, AdsRewardOffer? previousOffer)? error, - required TResult orElse(), - }) { - if (error != null) { - return error(message, previousOffer); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_NotAvailable value) notAvailable, - required TResult Function(_Ready value) ready, - required TResult Function(_Claiming value) claiming, - required TResult Function(_Success value) success, - required TResult Function(_Error value) error, - }) { - return error(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_NotAvailable value)? notAvailable, - TResult? Function(_Ready value)? ready, - TResult? Function(_Claiming value)? claiming, - TResult? Function(_Success value)? success, - TResult? Function(_Error value)? error, - }) { - return error?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_NotAvailable value)? notAvailable, - TResult Function(_Ready value)? ready, - TResult Function(_Claiming value)? claiming, - TResult Function(_Success value)? success, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (error != null) { - return error(this); - } - return orElse(); - } } -abstract class _Error implements AdsRewardState { - const factory _Error( - {required final String message, - final AdsRewardOffer? previousOffer}) = _$ErrorImpl; - - String get message; - AdsRewardOffer? get previousOffer; - @JsonKey(ignore: true) - _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => - throw _privateConstructorUsedError; -} +// dart format on diff --git a/mnemo_cards_web_v2/lib/domain/state/card_flipper_state_manager.dart b/mnemo_cards_web_v2/lib/domain/state/card_flipper_state_manager.dart index 37073c7..dc917d7 100644 --- a/mnemo_cards_web_v2/lib/domain/state/card_flipper_state_manager.dart +++ b/mnemo_cards_web_v2/lib/domain/state/card_flipper_state_manager.dart @@ -13,7 +13,7 @@ class CardFlipperState with _$CardFlipperState { const factory CardFlipperState.loaded({ required List cards, required int currentIndex, - required Map flippedCards, + required Map flippedCards, required bool isShuffled, }) = _Loaded; } @@ -94,7 +94,7 @@ class CardFlipperStateManager extends StateManager { final isFlipped = currentState.flippedCards[currentCardId] ?? false; final updatedFlippedCards = - Map.from(currentState.flippedCards); + Map.from(currentState.flippedCards); updatedFlippedCards[currentCardId] = !isFlipped; log( @@ -105,7 +105,7 @@ class CardFlipperStateManager extends StateManager { }); /// Toggle flip state of specific card - Future toggleCardFlip(int cardId) => handle((emit) async { + Future toggleCardFlip(String cardId) => handle((emit) async { final currentState = state; if (currentState is! _Loaded) { return; @@ -113,7 +113,7 @@ class CardFlipperStateManager extends StateManager { final isFlipped = currentState.flippedCards[cardId] ?? false; final updatedFlippedCards = - Map.from(currentState.flippedCards); + Map.from(currentState.flippedCards); updatedFlippedCards[cardId] = !isFlipped; log( @@ -185,7 +185,7 @@ class CardFlipperStateManager extends StateManager { } /// Check if specific card is flipped - bool isCardFlipped(int cardId) { + bool isCardFlipped(String cardId) { final currentState = state; if (currentState is! _Loaded) return false; diff --git a/mnemo_cards_web_v2/lib/domain/state/card_flipper_state_manager.freezed.dart b/mnemo_cards_web_v2/lib/domain/state/card_flipper_state_manager.freezed.dart index 44d198d..87b904a 100644 --- a/mnemo_cards_web_v2/lib/domain/state/card_flipper_state_manager.freezed.dart +++ b/mnemo_cards_web_v2/lib/domain/state/card_flipper_state_manager.freezed.dart @@ -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,381 +9,288 @@ part of 'card_flipper_state_manager.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - /// @nodoc mixin _$CardFlipperState { - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(List cards, int currentIndex, - Map flippedCards, bool isShuffled) - loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(List cards, int currentIndex, - Map flippedCards, bool isShuffled)? - loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(List cards, int currentIndex, - Map flippedCards, bool isShuffled)? - loaded, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loaded value) loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loaded value)? loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loaded value)? loaded, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; + + + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is CardFlipperState); +} + + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'CardFlipperState()'; +} + + } /// @nodoc -abstract class $CardFlipperStateCopyWith<$Res> { - factory $CardFlipperStateCopyWith( - CardFlipperState value, $Res Function(CardFlipperState) then) = - _$CardFlipperStateCopyWithImpl<$Res, CardFlipperState>; +class $CardFlipperStateCopyWith<$Res> { +$CardFlipperStateCopyWith(CardFlipperState _, $Res Function(CardFlipperState) __); } -/// @nodoc -class _$CardFlipperStateCopyWithImpl<$Res, $Val extends CardFlipperState> - implements $CardFlipperStateCopyWith<$Res> { - _$CardFlipperStateCopyWithImpl(this._value, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; +/// Adds pattern-matching-related methods to [CardFlipperState]. +extension CardFlipperStatePatterns on CardFlipperState { +/// 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 Function( _Initial value)? initial,TResult Function( _Loaded value)? loaded,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial(_that);case _Loaded() when loaded != null: +return loaded(_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({required TResult Function( _Initial value) initial,required TResult Function( _Loaded value) loaded,}){ +final _that = this; +switch (_that) { +case _Initial(): +return initial(_that);case _Loaded(): +return loaded(_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? Function( _Initial value)? initial,TResult? Function( _Loaded value)? loaded,}){ +final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial(_that);case _Loaded() when loaded != null: +return loaded(_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 Function()? initial,TResult Function( List cards, int currentIndex, Map flippedCards, bool isShuffled)? loaded,required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial();case _Loaded() when loaded != null: +return loaded(_that.cards,_that.currentIndex,_that.flippedCards,_that.isShuffled);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({required TResult Function() initial,required TResult Function( List cards, int currentIndex, Map flippedCards, bool isShuffled) loaded,}) {final _that = this; +switch (_that) { +case _Initial(): +return initial();case _Loaded(): +return loaded(_that.cards,_that.currentIndex,_that.flippedCards,_that.isShuffled);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? Function()? initial,TResult? Function( List cards, int currentIndex, Map flippedCards, bool isShuffled)? loaded,}) {final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial();case _Loaded() when loaded != null: +return loaded(_that.cards,_that.currentIndex,_that.flippedCards,_that.isShuffled);case _: + return null; + +} } -/// @nodoc -abstract class _$$InitialImplCopyWith<$Res> { - factory _$$InitialImplCopyWith( - _$InitialImpl value, $Res Function(_$InitialImpl) then) = - __$$InitialImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$InitialImplCopyWithImpl<$Res> - extends _$CardFlipperStateCopyWithImpl<$Res, _$InitialImpl> - implements _$$InitialImplCopyWith<$Res> { - __$$InitialImplCopyWithImpl( - _$InitialImpl _value, $Res Function(_$InitialImpl) _then) - : super(_value, _then); } /// @nodoc -class _$InitialImpl implements _Initial { - const _$InitialImpl(); - @override - String toString() { - return 'CardFlipperState.initial()'; - } +class _Initial implements CardFlipperState { + const _Initial(); + - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$InitialImpl); - } - @override - int get hashCode => runtimeType.hashCode; - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(List cards, int currentIndex, - Map flippedCards, bool isShuffled) - loaded, - }) { - return initial(); - } - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(List cards, int currentIndex, - Map flippedCards, bool isShuffled)? - loaded, - }) { - return initial?.call(); - } - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(List cards, int currentIndex, - Map flippedCards, bool isShuffled)? - loaded, - required TResult orElse(), - }) { - if (initial != null) { - return initial(); - } - return orElse(); - } - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loaded value) loaded, - }) { - return initial(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loaded value)? loaded, - }) { - return initial?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loaded value)? loaded, - required TResult orElse(), - }) { - if (initial != null) { - return initial(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Initial); } -abstract class _Initial implements CardFlipperState { - const factory _Initial() = _$InitialImpl; + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'CardFlipperState.initial()'; } -/// @nodoc -abstract class _$$LoadedImplCopyWith<$Res> { - factory _$$LoadedImplCopyWith( - _$LoadedImpl value, $Res Function(_$LoadedImpl) then) = - __$$LoadedImplCopyWithImpl<$Res>; - @useResult - $Res call( - {List cards, - int currentIndex, - Map flippedCards, - bool isShuffled}); + } -/// @nodoc -class __$$LoadedImplCopyWithImpl<$Res> - extends _$CardFlipperStateCopyWithImpl<$Res, _$LoadedImpl> - implements _$$LoadedImplCopyWith<$Res> { - __$$LoadedImplCopyWithImpl( - _$LoadedImpl _value, $Res Function(_$LoadedImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? cards = null, - Object? currentIndex = null, - Object? flippedCards = null, - Object? isShuffled = null, - }) { - return _then(_$LoadedImpl( - cards: null == cards - ? _value._cards - : cards // ignore: cast_nullable_to_non_nullable - as List, - currentIndex: null == currentIndex - ? _value.currentIndex - : currentIndex // ignore: cast_nullable_to_non_nullable - as int, - flippedCards: null == flippedCards - ? _value._flippedCards - : flippedCards // ignore: cast_nullable_to_non_nullable - as Map, - isShuffled: null == isShuffled - ? _value.isShuffled - : isShuffled // ignore: cast_nullable_to_non_nullable - as bool, - )); - } -} + /// @nodoc -class _$LoadedImpl implements _Loaded { - const _$LoadedImpl( - {required final List cards, - required this.currentIndex, - required final Map flippedCards, - required this.isShuffled}) - : _cards = cards, - _flippedCards = flippedCards; - final List _cards; - @override - List get cards { - if (_cards is EqualUnmodifiableListView) return _cards; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_cards); - } +class _Loaded implements CardFlipperState { + const _Loaded({required final List cards, required this.currentIndex, required final Map flippedCards, required this.isShuffled}): _cards = cards,_flippedCards = flippedCards; + - @override - final int currentIndex; - final Map _flippedCards; - @override - Map get flippedCards { - if (_flippedCards is EqualUnmodifiableMapView) return _flippedCards; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_flippedCards); - } - - @override - final bool isShuffled; - - @override - String toString() { - return 'CardFlipperState.loaded(cards: $cards, currentIndex: $currentIndex, flippedCards: $flippedCards, isShuffled: $isShuffled)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$LoadedImpl && - const DeepCollectionEquality().equals(other._cards, _cards) && - (identical(other.currentIndex, currentIndex) || - other.currentIndex == currentIndex) && - const DeepCollectionEquality() - .equals(other._flippedCards, _flippedCards) && - (identical(other.isShuffled, isShuffled) || - other.isShuffled == isShuffled)); - } - - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_cards), - currentIndex, - const DeepCollectionEquality().hash(_flippedCards), - isShuffled); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - __$$LoadedImplCopyWithImpl<_$LoadedImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(List cards, int currentIndex, - Map flippedCards, bool isShuffled) - loaded, - }) { - return loaded(cards, currentIndex, flippedCards, isShuffled); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(List cards, int currentIndex, - Map flippedCards, bool isShuffled)? - loaded, - }) { - return loaded?.call(cards, currentIndex, flippedCards, isShuffled); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(List cards, int currentIndex, - Map flippedCards, bool isShuffled)? - loaded, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(cards, currentIndex, flippedCards, isShuffled); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loaded value) loaded, - }) { - return loaded(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loaded value)? loaded, - }) { - return loaded?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loaded value)? loaded, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(this); - } - return orElse(); - } + final List _cards; + List get cards { + if (_cards is EqualUnmodifiableListView) return _cards; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_cards); } -abstract class _Loaded implements CardFlipperState { - const factory _Loaded( - {required final List cards, - required final int currentIndex, - required final Map flippedCards, - required final bool isShuffled}) = _$LoadedImpl; - - List get cards; - int get currentIndex; - Map get flippedCards; - bool get isShuffled; - @JsonKey(ignore: true) - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - throw _privateConstructorUsedError; + final int currentIndex; + final Map _flippedCards; + Map get flippedCards { + if (_flippedCards is EqualUnmodifiableMapView) return _flippedCards; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_flippedCards); } + + final bool isShuffled; + +/// Create a copy of CardFlipperState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LoadedCopyWith<_Loaded> get copyWith => __$LoadedCopyWithImpl<_Loaded>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loaded&&const DeepCollectionEquality().equals(other._cards, _cards)&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex)&&const DeepCollectionEquality().equals(other._flippedCards, _flippedCards)&&(identical(other.isShuffled, isShuffled) || other.isShuffled == isShuffled)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_cards),currentIndex,const DeepCollectionEquality().hash(_flippedCards),isShuffled); + +@override +String toString() { + return 'CardFlipperState.loaded(cards: $cards, currentIndex: $currentIndex, flippedCards: $flippedCards, isShuffled: $isShuffled)'; +} + + +} + +/// @nodoc +abstract mixin class _$LoadedCopyWith<$Res> implements $CardFlipperStateCopyWith<$Res> { + factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl; +@useResult +$Res call({ + List cards, int currentIndex, Map flippedCards, bool isShuffled +}); + + + + +} +/// @nodoc +class __$LoadedCopyWithImpl<$Res> + implements _$LoadedCopyWith<$Res> { + __$LoadedCopyWithImpl(this._self, this._then); + + final _Loaded _self; + final $Res Function(_Loaded) _then; + +/// Create a copy of CardFlipperState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? cards = null,Object? currentIndex = null,Object? flippedCards = null,Object? isShuffled = null,}) { + return _then(_Loaded( +cards: null == cards ? _self._cards : cards // ignore: cast_nullable_to_non_nullable +as List,currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable +as int,flippedCards: null == flippedCards ? _self._flippedCards : flippedCards // ignore: cast_nullable_to_non_nullable +as Map,isShuffled: null == isShuffled ? _self.isShuffled : isShuffled // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + +// dart format on diff --git a/mnemo_cards_web_v2/lib/domain/state/favorites_state_manager.dart b/mnemo_cards_web_v2/lib/domain/state/favorites_state_manager.dart index 48ac075..1ff6f30 100644 --- a/mnemo_cards_web_v2/lib/domain/state/favorites_state_manager.dart +++ b/mnemo_cards_web_v2/lib/domain/state/favorites_state_manager.dart @@ -11,7 +11,7 @@ part 'favorites_state_manager.freezed.dart'; class FavoritesState with _$FavoritesState { const factory FavoritesState.initial() = _Initial; const factory FavoritesState.loaded({ - required Set favorites, + required Set favorites, }) = _Loaded; } @@ -30,11 +30,8 @@ class FavoritesStateManager extends StateManager { log('Loading favorites', name: 'FavoritesStateManager'); try { final favoritesList = _sharedPreferences.getStringList(_favoritesKey) ?? []; - final favorites = favoritesList - .map((e) => int.tryParse(e)) - .whereType() - .toSet(); - emit(FavoritesState.loaded(favorites: favorites)); + final favorites = favoritesList.toSet(); + emit(FavoritesState.loaded(favorites: favorites)); log('Loaded ${favorites.length} favorites', name: 'FavoritesStateManager'); } catch (e, s) { log( @@ -49,7 +46,7 @@ class FavoritesStateManager extends StateManager { }); /// Toggle favorite status for a card - Future toggleFavorite(int cardId) => handle((emit) async { + Future toggleFavorite(String cardId) => handle((emit) async { log('Toggling favorite for card $cardId', name: 'FavoritesStateManager'); final currentState = state; @@ -59,7 +56,7 @@ class FavoritesStateManager extends StateManager { return; } - final Set updatedFavorites; + final Set updatedFavorites; if (currentState.favorites.contains(cardId)) { updatedFavorites = Set.from(currentState.favorites)..remove(cardId); log('Removed card $cardId from favorites', name: 'FavoritesStateManager'); @@ -70,7 +67,7 @@ class FavoritesStateManager extends StateManager { // Save to SharedPreferences try { - final favoritesList = updatedFavorites.map((e) => e.toString()).toList(); + final favoritesList = updatedFavorites.toList(); await _sharedPreferences.setStringList(_favoritesKey, favoritesList); emit(FavoritesState.loaded(favorites: updatedFavorites)); } catch (e, s) { @@ -85,7 +82,7 @@ class FavoritesStateManager extends StateManager { }); /// Check if a card is favorite - bool isFavorite(int cardId) { + bool isFavorite(String cardId) { final currentState = state; if (currentState is _Loaded) { return currentState.favorites.contains(cardId); @@ -94,7 +91,7 @@ class FavoritesStateManager extends StateManager { } /// Get all favorite IDs - Set get favorites { + Set get favorites { final currentState = state; if (currentState is _Loaded) { return currentState.favorites; diff --git a/mnemo_cards_web_v2/lib/domain/state/favorites_state_manager.freezed.dart b/mnemo_cards_web_v2/lib/domain/state/favorites_state_manager.freezed.dart index 77a473e..fea397c 100644 --- a/mnemo_cards_web_v2/lib/domain/state/favorites_state_manager.freezed.dart +++ b/mnemo_cards_web_v2/lib/domain/state/favorites_state_manager.freezed.dart @@ -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,310 +9,276 @@ part of 'favorites_state_manager.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - /// @nodoc mixin _$FavoritesState { - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(Set favorites) loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(Set favorites)? loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(Set favorites)? loaded, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loaded value) loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loaded value)? loaded, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loaded value)? loaded, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; + + + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is FavoritesState); +} + + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'FavoritesState()'; +} + + } /// @nodoc -abstract class $FavoritesStateCopyWith<$Res> { - factory $FavoritesStateCopyWith( - FavoritesState value, $Res Function(FavoritesState) then) = - _$FavoritesStateCopyWithImpl<$Res, FavoritesState>; +class $FavoritesStateCopyWith<$Res> { +$FavoritesStateCopyWith(FavoritesState _, $Res Function(FavoritesState) __); } -/// @nodoc -class _$FavoritesStateCopyWithImpl<$Res, $Val extends FavoritesState> - implements $FavoritesStateCopyWith<$Res> { - _$FavoritesStateCopyWithImpl(this._value, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; +/// Adds pattern-matching-related methods to [FavoritesState]. +extension FavoritesStatePatterns on FavoritesState { +/// 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 Function( _Initial value)? initial,TResult Function( _Loaded value)? loaded,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial(_that);case _Loaded() when loaded != null: +return loaded(_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({required TResult Function( _Initial value) initial,required TResult Function( _Loaded value) loaded,}){ +final _that = this; +switch (_that) { +case _Initial(): +return initial(_that);case _Loaded(): +return loaded(_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? Function( _Initial value)? initial,TResult? Function( _Loaded value)? loaded,}){ +final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial(_that);case _Loaded() when loaded != null: +return loaded(_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 Function()? initial,TResult Function( Set favorites)? loaded,required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial();case _Loaded() when loaded != null: +return loaded(_that.favorites);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({required TResult Function() initial,required TResult Function( Set favorites) loaded,}) {final _that = this; +switch (_that) { +case _Initial(): +return initial();case _Loaded(): +return loaded(_that.favorites);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? Function()? initial,TResult? Function( Set favorites)? loaded,}) {final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial();case _Loaded() when loaded != null: +return loaded(_that.favorites);case _: + return null; + +} } -/// @nodoc -abstract class _$$InitialImplCopyWith<$Res> { - factory _$$InitialImplCopyWith( - _$InitialImpl value, $Res Function(_$InitialImpl) then) = - __$$InitialImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$InitialImplCopyWithImpl<$Res> - extends _$FavoritesStateCopyWithImpl<$Res, _$InitialImpl> - implements _$$InitialImplCopyWith<$Res> { - __$$InitialImplCopyWithImpl( - _$InitialImpl _value, $Res Function(_$InitialImpl) _then) - : super(_value, _then); } /// @nodoc -class _$InitialImpl implements _Initial { - const _$InitialImpl(); - @override - String toString() { - return 'FavoritesState.initial()'; - } +class _Initial implements FavoritesState { + const _Initial(); + - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$InitialImpl); - } - @override - int get hashCode => runtimeType.hashCode; - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(Set favorites) loaded, - }) { - return initial(); - } - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(Set favorites)? loaded, - }) { - return initial?.call(); - } - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(Set favorites)? loaded, - required TResult orElse(), - }) { - if (initial != null) { - return initial(); - } - return orElse(); - } - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loaded value) loaded, - }) { - return initial(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loaded value)? loaded, - }) { - return initial?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loaded value)? loaded, - required TResult orElse(), - }) { - if (initial != null) { - return initial(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Initial); } -abstract class _Initial implements FavoritesState { - const factory _Initial() = _$InitialImpl; + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'FavoritesState.initial()'; } -/// @nodoc -abstract class _$$LoadedImplCopyWith<$Res> { - factory _$$LoadedImplCopyWith( - _$LoadedImpl value, $Res Function(_$LoadedImpl) then) = - __$$LoadedImplCopyWithImpl<$Res>; - @useResult - $Res call({Set favorites}); + } -/// @nodoc -class __$$LoadedImplCopyWithImpl<$Res> - extends _$FavoritesStateCopyWithImpl<$Res, _$LoadedImpl> - implements _$$LoadedImplCopyWith<$Res> { - __$$LoadedImplCopyWithImpl( - _$LoadedImpl _value, $Res Function(_$LoadedImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? favorites = null, - }) { - return _then(_$LoadedImpl( - favorites: null == favorites - ? _value._favorites - : favorites // ignore: cast_nullable_to_non_nullable - as Set, - )); - } -} + /// @nodoc -class _$LoadedImpl implements _Loaded { - const _$LoadedImpl({required final Set favorites}) - : _favorites = favorites; - final Set _favorites; - @override - Set get favorites { - if (_favorites is EqualUnmodifiableSetView) return _favorites; - // ignore: implicit_dynamic_type - return EqualUnmodifiableSetView(_favorites); - } +class _Loaded implements FavoritesState { + const _Loaded({required final Set favorites}): _favorites = favorites; + - @override - String toString() { - return 'FavoritesState.loaded(favorites: $favorites)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$LoadedImpl && - const DeepCollectionEquality() - .equals(other._favorites, _favorites)); - } - - @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(_favorites)); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - __$$LoadedImplCopyWithImpl<_$LoadedImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function(Set favorites) loaded, - }) { - return loaded(favorites); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function(Set favorites)? loaded, - }) { - return loaded?.call(favorites); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function(Set favorites)? loaded, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(favorites); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loaded value) loaded, - }) { - return loaded(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loaded value)? loaded, - }) { - return loaded?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loaded value)? loaded, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(this); - } - return orElse(); - } + final Set _favorites; + Set get favorites { + if (_favorites is EqualUnmodifiableSetView) return _favorites; + // ignore: implicit_dynamic_type + return EqualUnmodifiableSetView(_favorites); } -abstract class _Loaded implements FavoritesState { - const factory _Loaded({required final Set favorites}) = _$LoadedImpl; - Set get favorites; - @JsonKey(ignore: true) - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - throw _privateConstructorUsedError; +/// Create a copy of FavoritesState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LoadedCopyWith<_Loaded> get copyWith => __$LoadedCopyWithImpl<_Loaded>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loaded&&const DeepCollectionEquality().equals(other._favorites, _favorites)); } + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_favorites)); + +@override +String toString() { + return 'FavoritesState.loaded(favorites: $favorites)'; +} + + +} + +/// @nodoc +abstract mixin class _$LoadedCopyWith<$Res> implements $FavoritesStateCopyWith<$Res> { + factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl; +@useResult +$Res call({ + Set favorites +}); + + + + +} +/// @nodoc +class __$LoadedCopyWithImpl<$Res> + implements _$LoadedCopyWith<$Res> { + __$LoadedCopyWithImpl(this._self, this._then); + + final _Loaded _self; + final $Res Function(_Loaded) _then; + +/// Create a copy of FavoritesState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? favorites = null,}) { + return _then(_Loaded( +favorites: null == favorites ? _self._favorites : favorites // ignore: cast_nullable_to_non_nullable +as Set, + )); +} + + +} + +// dart format on diff --git a/mnemo_cards_web_v2/lib/domain/state/games_state_manager.freezed.dart b/mnemo_cards_web_v2/lib/domain/state/games_state_manager.freezed.dart index 483e48a..2687e67 100644 --- a/mnemo_cards_web_v2/lib/domain/state/games_state_manager.freezed.dart +++ b/mnemo_cards_web_v2/lib/domain/state/games_state_manager.freezed.dart @@ -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,481 +9,350 @@ part of 'games_state_manager.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - /// @nodoc mixin _$GamesState { - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function(List games, String searchQuery) loaded, - required TResult Function(String message) error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List games, String searchQuery)? loaded, - TResult? Function(String message)? error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List games, String searchQuery)? loaded, - TResult Function(String message)? error, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; + + + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is GamesState); +} + + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'GamesState()'; +} + + } /// @nodoc -abstract class $GamesStateCopyWith<$Res> { - factory $GamesStateCopyWith( - GamesState value, $Res Function(GamesState) then) = - _$GamesStateCopyWithImpl<$Res, GamesState>; +class $GamesStateCopyWith<$Res> { +$GamesStateCopyWith(GamesState _, $Res Function(GamesState) __); } -/// @nodoc -class _$GamesStateCopyWithImpl<$Res, $Val extends GamesState> - implements $GamesStateCopyWith<$Res> { - _$GamesStateCopyWithImpl(this._value, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; +/// Adds pattern-matching-related methods to [GamesState]. +extension GamesStatePatterns on GamesState { +/// 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 Function( _Loading value)? loading,TResult Function( _Loaded value)? loaded,TResult Function( _Error value)? error,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading(_that);case _Loaded() when loaded != null: +return loaded(_that);case _Error() when error != null: +return error(_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({required TResult Function( _Loading value) loading,required TResult Function( _Loaded value) loaded,required TResult Function( _Error value) error,}){ +final _that = this; +switch (_that) { +case _Loading(): +return loading(_that);case _Loaded(): +return loaded(_that);case _Error(): +return error(_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? Function( _Loading value)? loading,TResult? Function( _Loaded value)? loaded,TResult? Function( _Error value)? error,}){ +final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading(_that);case _Loaded() when loaded != null: +return loaded(_that);case _Error() when error != null: +return error(_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 Function()? loading,TResult Function( List games, String searchQuery)? loaded,TResult Function( String message)? error,required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading();case _Loaded() when loaded != null: +return loaded(_that.games,_that.searchQuery);case _Error() when error != null: +return error(_that.message);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({required TResult Function() loading,required TResult Function( List games, String searchQuery) loaded,required TResult Function( String message) error,}) {final _that = this; +switch (_that) { +case _Loading(): +return loading();case _Loaded(): +return loaded(_that.games,_that.searchQuery);case _Error(): +return error(_that.message);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? Function()? loading,TResult? Function( List games, String searchQuery)? loaded,TResult? Function( String message)? error,}) {final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading();case _Loaded() when loaded != null: +return loaded(_that.games,_that.searchQuery);case _Error() when error != null: +return error(_that.message);case _: + return null; + +} } -/// @nodoc -abstract class _$$LoadingImplCopyWith<$Res> { - factory _$$LoadingImplCopyWith( - _$LoadingImpl value, $Res Function(_$LoadingImpl) then) = - __$$LoadingImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$LoadingImplCopyWithImpl<$Res> - extends _$GamesStateCopyWithImpl<$Res, _$LoadingImpl> - implements _$$LoadingImplCopyWith<$Res> { - __$$LoadingImplCopyWithImpl( - _$LoadingImpl _value, $Res Function(_$LoadingImpl) _then) - : super(_value, _then); } /// @nodoc -class _$LoadingImpl implements _Loading { - const _$LoadingImpl(); - @override - String toString() { - return 'GamesState.loading()'; - } +class _Loading implements GamesState { + const _Loading(); + - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$LoadingImpl); - } - @override - int get hashCode => runtimeType.hashCode; - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function(List games, String searchQuery) loaded, - required TResult Function(String message) error, - }) { - return loading(); - } - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List games, String searchQuery)? loaded, - TResult? Function(String message)? error, - }) { - return loading?.call(); - } - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List games, String searchQuery)? loaded, - TResult Function(String message)? error, - required TResult orElse(), - }) { - if (loading != null) { - return loading(); - } - return orElse(); - } - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - }) { - return loading(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - }) { - return loading?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (loading != null) { - return loading(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loading); } -abstract class _Loading implements GamesState { - const factory _Loading() = _$LoadingImpl; + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'GamesState.loading()'; +} + + +} + + + + +/// @nodoc + + +class _Loaded implements GamesState { + const _Loaded({required final List games, this.searchQuery = ''}): _games = games; + + + final List _games; + List get games { + if (_games is EqualUnmodifiableListView) return _games; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_games); +} + +@JsonKey() final String searchQuery; + +/// Create a copy of GamesState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LoadedCopyWith<_Loaded> get copyWith => __$LoadedCopyWithImpl<_Loaded>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loaded&&const DeepCollectionEquality().equals(other._games, _games)&&(identical(other.searchQuery, searchQuery) || other.searchQuery == searchQuery)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_games),searchQuery); + +@override +String toString() { + return 'GamesState.loaded(games: $games, searchQuery: $searchQuery)'; +} + + } /// @nodoc -abstract class _$$LoadedImplCopyWith<$Res> { - factory _$$LoadedImplCopyWith( - _$LoadedImpl value, $Res Function(_$LoadedImpl) then) = - __$$LoadedImplCopyWithImpl<$Res>; - @useResult - $Res call({List games, String searchQuery}); +abstract mixin class _$LoadedCopyWith<$Res> implements $GamesStateCopyWith<$Res> { + factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl; +@useResult +$Res call({ + List games, String searchQuery +}); + + + + +} +/// @nodoc +class __$LoadedCopyWithImpl<$Res> + implements _$LoadedCopyWith<$Res> { + __$LoadedCopyWithImpl(this._self, this._then); + + final _Loaded _self; + final $Res Function(_Loaded) _then; + +/// Create a copy of GamesState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? games = null,Object? searchQuery = null,}) { + return _then(_Loaded( +games: null == games ? _self._games : games // ignore: cast_nullable_to_non_nullable +as List,searchQuery: null == searchQuery ? _self.searchQuery : searchQuery // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -class __$$LoadedImplCopyWithImpl<$Res> - extends _$GamesStateCopyWithImpl<$Res, _$LoadedImpl> - implements _$$LoadedImplCopyWith<$Res> { - __$$LoadedImplCopyWithImpl( - _$LoadedImpl _value, $Res Function(_$LoadedImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? games = null, - Object? searchQuery = null, - }) { - return _then(_$LoadedImpl( - games: null == games - ? _value._games - : games // ignore: cast_nullable_to_non_nullable - as List, - searchQuery: null == searchQuery - ? _value.searchQuery - : searchQuery // ignore: cast_nullable_to_non_nullable - as String, - )); - } } /// @nodoc -class _$LoadedImpl implements _Loaded { - const _$LoadedImpl( - {required final List games, this.searchQuery = ''}) - : _games = games; - final List _games; - @override - List get games { - if (_games is EqualUnmodifiableListView) return _games; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_games); - } +class _Error implements GamesState { + const _Error(this.message); + - @override - @JsonKey() - final String searchQuery; + final String message; - @override - String toString() { - return 'GamesState.loaded(games: $games, searchQuery: $searchQuery)'; - } +/// Create a copy of GamesState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ErrorCopyWith<_Error> get copyWith => __$ErrorCopyWithImpl<_Error>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$LoadedImpl && - const DeepCollectionEquality().equals(other._games, _games) && - (identical(other.searchQuery, searchQuery) || - other.searchQuery == searchQuery)); - } - @override - int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_games), searchQuery); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - __$$LoadedImplCopyWithImpl<_$LoadedImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function(List games, String searchQuery) loaded, - required TResult Function(String message) error, - }) { - return loaded(games, searchQuery); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List games, String searchQuery)? loaded, - TResult? Function(String message)? error, - }) { - return loaded?.call(games, searchQuery); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List games, String searchQuery)? loaded, - TResult Function(String message)? error, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(games, searchQuery); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - }) { - return loaded(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - }) { - return loaded?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Error&&(identical(other.message, message) || other.message == message)); +} + + +@override +int get hashCode => Object.hash(runtimeType,message); + +@override +String toString() { + return 'GamesState.error(message: $message)'; } -abstract class _Loaded implements GamesState { - const factory _Loaded( - {required final List games, - final String searchQuery}) = _$LoadedImpl; - List get games; - String get searchQuery; - @JsonKey(ignore: true) - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$ErrorImplCopyWith<$Res> { - factory _$$ErrorImplCopyWith( - _$ErrorImpl value, $Res Function(_$ErrorImpl) then) = - __$$ErrorImplCopyWithImpl<$Res>; - @useResult - $Res call({String message}); -} +abstract mixin class _$ErrorCopyWith<$Res> implements $GamesStateCopyWith<$Res> { + factory _$ErrorCopyWith(_Error value, $Res Function(_Error) _then) = __$ErrorCopyWithImpl; +@useResult +$Res call({ + String message +}); + + + +} /// @nodoc -class __$$ErrorImplCopyWithImpl<$Res> - extends _$GamesStateCopyWithImpl<$Res, _$ErrorImpl> - implements _$$ErrorImplCopyWith<$Res> { - __$$ErrorImplCopyWithImpl( - _$ErrorImpl _value, $Res Function(_$ErrorImpl) _then) - : super(_value, _then); +class __$ErrorCopyWithImpl<$Res> + implements _$ErrorCopyWith<$Res> { + __$ErrorCopyWithImpl(this._self, this._then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? message = null, - }) { - return _then(_$ErrorImpl( - null == message - ? _value.message - : message // ignore: cast_nullable_to_non_nullable - as String, - )); - } + final _Error _self; + final $Res Function(_Error) _then; + +/// Create a copy of GamesState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? message = null,}) { + return _then(_Error( +null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -class _$ErrorImpl implements _Error { - const _$ErrorImpl(this.message); - - @override - final String message; - - @override - String toString() { - return 'GamesState.error(message: $message)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ErrorImpl && - (identical(other.message, message) || other.message == message)); - } - - @override - int get hashCode => Object.hash(runtimeType, message); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => - __$$ErrorImplCopyWithImpl<_$ErrorImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function(List games, String searchQuery) loaded, - required TResult Function(String message) error, - }) { - return error(message); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List games, String searchQuery)? loaded, - TResult? Function(String message)? error, - }) { - return error?.call(message); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List games, String searchQuery)? loaded, - TResult Function(String message)? error, - required TResult orElse(), - }) { - if (error != null) { - return error(message); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - }) { - return error(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - }) { - return error?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (error != null) { - return error(this); - } - return orElse(); - } } -abstract class _Error implements GamesState { - const factory _Error(final String message) = _$ErrorImpl; - - String get message; - @JsonKey(ignore: true) - _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => - throw _privateConstructorUsedError; -} +// dart format on diff --git a/mnemo_cards_web_v2/lib/domain/state/packs_state_manager.freezed.dart b/mnemo_cards_web_v2/lib/domain/state/packs_state_manager.freezed.dart index 805db05..fe18e14 100644 --- a/mnemo_cards_web_v2/lib/domain/state/packs_state_manager.freezed.dart +++ b/mnemo_cards_web_v2/lib/domain/state/packs_state_manager.freezed.dart @@ -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,497 +9,350 @@ part of 'packs_state_manager.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - /// @nodoc mixin _$PacksState { - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function( - List packs, String searchQuery) - loaded, - required TResult Function(String message) error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List packs, String searchQuery)? - loaded, - TResult? Function(String message)? error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List packs, String searchQuery)? - loaded, - TResult Function(String message)? error, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; + + + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PacksState); +} + + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'PacksState()'; +} + + } /// @nodoc -abstract class $PacksStateCopyWith<$Res> { - factory $PacksStateCopyWith( - PacksState value, $Res Function(PacksState) then) = - _$PacksStateCopyWithImpl<$Res, PacksState>; +class $PacksStateCopyWith<$Res> { +$PacksStateCopyWith(PacksState _, $Res Function(PacksState) __); } -/// @nodoc -class _$PacksStateCopyWithImpl<$Res, $Val extends PacksState> - implements $PacksStateCopyWith<$Res> { - _$PacksStateCopyWithImpl(this._value, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; +/// Adds pattern-matching-related methods to [PacksState]. +extension PacksStatePatterns on PacksState { +/// 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 Function( _Loading value)? loading,TResult Function( _Loaded value)? loaded,TResult Function( _Error value)? error,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading(_that);case _Loaded() when loaded != null: +return loaded(_that);case _Error() when error != null: +return error(_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({required TResult Function( _Loading value) loading,required TResult Function( _Loaded value) loaded,required TResult Function( _Error value) error,}){ +final _that = this; +switch (_that) { +case _Loading(): +return loading(_that);case _Loaded(): +return loaded(_that);case _Error(): +return error(_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? Function( _Loading value)? loading,TResult? Function( _Loaded value)? loaded,TResult? Function( _Error value)? error,}){ +final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading(_that);case _Loaded() when loaded != null: +return loaded(_that);case _Error() when error != null: +return error(_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 Function()? loading,TResult Function( List packs, String searchQuery)? loaded,TResult Function( String message)? error,required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading();case _Loaded() when loaded != null: +return loaded(_that.packs,_that.searchQuery);case _Error() when error != null: +return error(_that.message);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({required TResult Function() loading,required TResult Function( List packs, String searchQuery) loaded,required TResult Function( String message) error,}) {final _that = this; +switch (_that) { +case _Loading(): +return loading();case _Loaded(): +return loaded(_that.packs,_that.searchQuery);case _Error(): +return error(_that.message);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? Function()? loading,TResult? Function( List packs, String searchQuery)? loaded,TResult? Function( String message)? error,}) {final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading();case _Loaded() when loaded != null: +return loaded(_that.packs,_that.searchQuery);case _Error() when error != null: +return error(_that.message);case _: + return null; + +} } -/// @nodoc -abstract class _$$LoadingImplCopyWith<$Res> { - factory _$$LoadingImplCopyWith( - _$LoadingImpl value, $Res Function(_$LoadingImpl) then) = - __$$LoadingImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$LoadingImplCopyWithImpl<$Res> - extends _$PacksStateCopyWithImpl<$Res, _$LoadingImpl> - implements _$$LoadingImplCopyWith<$Res> { - __$$LoadingImplCopyWithImpl( - _$LoadingImpl _value, $Res Function(_$LoadingImpl) _then) - : super(_value, _then); } /// @nodoc -class _$LoadingImpl implements _Loading { - const _$LoadingImpl(); - @override - String toString() { - return 'PacksState.loading()'; - } +class _Loading implements PacksState { + const _Loading(); + - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$LoadingImpl); - } - @override - int get hashCode => runtimeType.hashCode; - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function( - List packs, String searchQuery) - loaded, - required TResult Function(String message) error, - }) { - return loading(); - } - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List packs, String searchQuery)? - loaded, - TResult? Function(String message)? error, - }) { - return loading?.call(); - } - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List packs, String searchQuery)? - loaded, - TResult Function(String message)? error, - required TResult orElse(), - }) { - if (loading != null) { - return loading(); - } - return orElse(); - } - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - }) { - return loading(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - }) { - return loading?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (loading != null) { - return loading(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loading); } -abstract class _Loading implements PacksState { - const factory _Loading() = _$LoadingImpl; + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'PacksState.loading()'; +} + + +} + + + + +/// @nodoc + + +class _Loaded implements PacksState { + const _Loaded({required final List packs, this.searchQuery = ''}): _packs = packs; + + + final List _packs; + List get packs { + if (_packs is EqualUnmodifiableListView) return _packs; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_packs); +} + +@JsonKey() final String searchQuery; + +/// Create a copy of PacksState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LoadedCopyWith<_Loaded> get copyWith => __$LoadedCopyWithImpl<_Loaded>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loaded&&const DeepCollectionEquality().equals(other._packs, _packs)&&(identical(other.searchQuery, searchQuery) || other.searchQuery == searchQuery)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_packs),searchQuery); + +@override +String toString() { + return 'PacksState.loaded(packs: $packs, searchQuery: $searchQuery)'; +} + + } /// @nodoc -abstract class _$$LoadedImplCopyWith<$Res> { - factory _$$LoadedImplCopyWith( - _$LoadedImpl value, $Res Function(_$LoadedImpl) then) = - __$$LoadedImplCopyWithImpl<$Res>; - @useResult - $Res call({List packs, String searchQuery}); +abstract mixin class _$LoadedCopyWith<$Res> implements $PacksStateCopyWith<$Res> { + factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl; +@useResult +$Res call({ + List packs, String searchQuery +}); + + + + +} +/// @nodoc +class __$LoadedCopyWithImpl<$Res> + implements _$LoadedCopyWith<$Res> { + __$LoadedCopyWithImpl(this._self, this._then); + + final _Loaded _self; + final $Res Function(_Loaded) _then; + +/// Create a copy of PacksState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? packs = null,Object? searchQuery = null,}) { + return _then(_Loaded( +packs: null == packs ? _self._packs : packs // ignore: cast_nullable_to_non_nullable +as List,searchQuery: null == searchQuery ? _self.searchQuery : searchQuery // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -class __$$LoadedImplCopyWithImpl<$Res> - extends _$PacksStateCopyWithImpl<$Res, _$LoadedImpl> - implements _$$LoadedImplCopyWith<$Res> { - __$$LoadedImplCopyWithImpl( - _$LoadedImpl _value, $Res Function(_$LoadedImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? packs = null, - Object? searchQuery = null, - }) { - return _then(_$LoadedImpl( - packs: null == packs - ? _value._packs - : packs // ignore: cast_nullable_to_non_nullable - as List, - searchQuery: null == searchQuery - ? _value.searchQuery - : searchQuery // ignore: cast_nullable_to_non_nullable - as String, - )); - } } /// @nodoc -class _$LoadedImpl implements _Loaded { - const _$LoadedImpl( - {required final List packs, this.searchQuery = ''}) - : _packs = packs; - final List _packs; - @override - List get packs { - if (_packs is EqualUnmodifiableListView) return _packs; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_packs); - } +class _Error implements PacksState { + const _Error(this.message); + - @override - @JsonKey() - final String searchQuery; + final String message; - @override - String toString() { - return 'PacksState.loaded(packs: $packs, searchQuery: $searchQuery)'; - } +/// Create a copy of PacksState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ErrorCopyWith<_Error> get copyWith => __$ErrorCopyWithImpl<_Error>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$LoadedImpl && - const DeepCollectionEquality().equals(other._packs, _packs) && - (identical(other.searchQuery, searchQuery) || - other.searchQuery == searchQuery)); - } - @override - int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_packs), searchQuery); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - __$$LoadedImplCopyWithImpl<_$LoadedImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function( - List packs, String searchQuery) - loaded, - required TResult Function(String message) error, - }) { - return loaded(packs, searchQuery); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List packs, String searchQuery)? - loaded, - TResult? Function(String message)? error, - }) { - return loaded?.call(packs, searchQuery); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List packs, String searchQuery)? - loaded, - TResult Function(String message)? error, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(packs, searchQuery); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - }) { - return loaded(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - }) { - return loaded?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Error&&(identical(other.message, message) || other.message == message)); +} + + +@override +int get hashCode => Object.hash(runtimeType,message); + +@override +String toString() { + return 'PacksState.error(message: $message)'; } -abstract class _Loaded implements PacksState { - const factory _Loaded( - {required final List packs, - final String searchQuery}) = _$LoadedImpl; - List get packs; - String get searchQuery; - @JsonKey(ignore: true) - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$ErrorImplCopyWith<$Res> { - factory _$$ErrorImplCopyWith( - _$ErrorImpl value, $Res Function(_$ErrorImpl) then) = - __$$ErrorImplCopyWithImpl<$Res>; - @useResult - $Res call({String message}); -} +abstract mixin class _$ErrorCopyWith<$Res> implements $PacksStateCopyWith<$Res> { + factory _$ErrorCopyWith(_Error value, $Res Function(_Error) _then) = __$ErrorCopyWithImpl; +@useResult +$Res call({ + String message +}); + + + +} /// @nodoc -class __$$ErrorImplCopyWithImpl<$Res> - extends _$PacksStateCopyWithImpl<$Res, _$ErrorImpl> - implements _$$ErrorImplCopyWith<$Res> { - __$$ErrorImplCopyWithImpl( - _$ErrorImpl _value, $Res Function(_$ErrorImpl) _then) - : super(_value, _then); +class __$ErrorCopyWithImpl<$Res> + implements _$ErrorCopyWith<$Res> { + __$ErrorCopyWithImpl(this._self, this._then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? message = null, - }) { - return _then(_$ErrorImpl( - null == message - ? _value.message - : message // ignore: cast_nullable_to_non_nullable - as String, - )); - } + final _Error _self; + final $Res Function(_Error) _then; + +/// Create a copy of PacksState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? message = null,}) { + return _then(_Error( +null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -class _$ErrorImpl implements _Error { - const _$ErrorImpl(this.message); - - @override - final String message; - - @override - String toString() { - return 'PacksState.error(message: $message)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ErrorImpl && - (identical(other.message, message) || other.message == message)); - } - - @override - int get hashCode => Object.hash(runtimeType, message); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => - __$$ErrorImplCopyWithImpl<_$ErrorImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function( - List packs, String searchQuery) - loaded, - required TResult Function(String message) error, - }) { - return error(message); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List packs, String searchQuery)? - loaded, - TResult? Function(String message)? error, - }) { - return error?.call(message); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List packs, String searchQuery)? - loaded, - TResult Function(String message)? error, - required TResult orElse(), - }) { - if (error != null) { - return error(message); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - }) { - return error(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - }) { - return error?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - required TResult orElse(), - }) { - if (error != null) { - return error(this); - } - return orElse(); - } } -abstract class _Error implements PacksState { - const factory _Error(final String message) = _$ErrorImpl; - - String get message; - @JsonKey(ignore: true) - _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => - throw _privateConstructorUsedError; -} +// dart format on diff --git a/mnemo_cards_web_v2/lib/domain/state/purchase_state_manager.freezed.dart b/mnemo_cards_web_v2/lib/domain/state/purchase_state_manager.freezed.dart index e80e13e..534a9c2 100644 --- a/mnemo_cards_web_v2/lib/domain/state/purchase_state_manager.freezed.dart +++ b/mnemo_cards_web_v2/lib/domain/state/purchase_state_manager.freezed.dart @@ -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,994 +9,526 @@ part of 'purchase_state_manager.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - /// @nodoc mixin _$PurchaseState { - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function() loading, - required TResult Function(CardPackBuyDto packInfo) loaded, - required TResult Function(String message) error, - required TResult Function(CardPackBuyDto packInfo) purchasing, - required TResult Function(CardPackBuyDto packInfo, String message) - completed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function()? loading, - TResult? Function(CardPackBuyDto packInfo)? loaded, - TResult? Function(String message)? error, - TResult? Function(CardPackBuyDto packInfo)? purchasing, - TResult? Function(CardPackBuyDto packInfo, String message)? completed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function()? loading, - TResult Function(CardPackBuyDto packInfo)? loaded, - TResult Function(String message)? error, - TResult Function(CardPackBuyDto packInfo)? purchasing, - TResult Function(CardPackBuyDto packInfo, String message)? completed, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_Purchasing value) purchasing, - required TResult Function(_Completed value) completed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_Purchasing value)? purchasing, - TResult? Function(_Completed value)? completed, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_Purchasing value)? purchasing, - TResult Function(_Completed value)? completed, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; + + + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PurchaseState); +} + + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'PurchaseState()'; +} + + } /// @nodoc -abstract class $PurchaseStateCopyWith<$Res> { - factory $PurchaseStateCopyWith( - PurchaseState value, $Res Function(PurchaseState) then) = - _$PurchaseStateCopyWithImpl<$Res, PurchaseState>; +class $PurchaseStateCopyWith<$Res> { +$PurchaseStateCopyWith(PurchaseState _, $Res Function(PurchaseState) __); } -/// @nodoc -class _$PurchaseStateCopyWithImpl<$Res, $Val extends PurchaseState> - implements $PurchaseStateCopyWith<$Res> { - _$PurchaseStateCopyWithImpl(this._value, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; +/// Adds pattern-matching-related methods to [PurchaseState]. +extension PurchaseStatePatterns on PurchaseState { +/// 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 Function( _Initial value)? initial,TResult Function( _Loading value)? loading,TResult Function( _Loaded value)? loaded,TResult Function( _Error value)? error,TResult Function( _Purchasing value)? purchasing,TResult Function( _Completed value)? completed,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial(_that);case _Loading() when loading != null: +return loading(_that);case _Loaded() when loaded != null: +return loaded(_that);case _Error() when error != null: +return error(_that);case _Purchasing() when purchasing != null: +return purchasing(_that);case _Completed() when completed != null: +return completed(_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({required TResult Function( _Initial value) initial,required TResult Function( _Loading value) loading,required TResult Function( _Loaded value) loaded,required TResult Function( _Error value) error,required TResult Function( _Purchasing value) purchasing,required TResult Function( _Completed value) completed,}){ +final _that = this; +switch (_that) { +case _Initial(): +return initial(_that);case _Loading(): +return loading(_that);case _Loaded(): +return loaded(_that);case _Error(): +return error(_that);case _Purchasing(): +return purchasing(_that);case _Completed(): +return completed(_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? Function( _Initial value)? initial,TResult? Function( _Loading value)? loading,TResult? Function( _Loaded value)? loaded,TResult? Function( _Error value)? error,TResult? Function( _Purchasing value)? purchasing,TResult? Function( _Completed value)? completed,}){ +final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial(_that);case _Loading() when loading != null: +return loading(_that);case _Loaded() when loaded != null: +return loaded(_that);case _Error() when error != null: +return error(_that);case _Purchasing() when purchasing != null: +return purchasing(_that);case _Completed() when completed != null: +return completed(_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 Function()? initial,TResult Function()? loading,TResult Function( CardPackBuyDto packInfo)? loaded,TResult Function( String message)? error,TResult Function( CardPackBuyDto packInfo)? purchasing,TResult Function( CardPackBuyDto packInfo, String message)? completed,required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial();case _Loading() when loading != null: +return loading();case _Loaded() when loaded != null: +return loaded(_that.packInfo);case _Error() when error != null: +return error(_that.message);case _Purchasing() when purchasing != null: +return purchasing(_that.packInfo);case _Completed() when completed != null: +return completed(_that.packInfo,_that.message);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({required TResult Function() initial,required TResult Function() loading,required TResult Function( CardPackBuyDto packInfo) loaded,required TResult Function( String message) error,required TResult Function( CardPackBuyDto packInfo) purchasing,required TResult Function( CardPackBuyDto packInfo, String message) completed,}) {final _that = this; +switch (_that) { +case _Initial(): +return initial();case _Loading(): +return loading();case _Loaded(): +return loaded(_that.packInfo);case _Error(): +return error(_that.message);case _Purchasing(): +return purchasing(_that.packInfo);case _Completed(): +return completed(_that.packInfo,_that.message);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? Function()? initial,TResult? Function()? loading,TResult? Function( CardPackBuyDto packInfo)? loaded,TResult? Function( String message)? error,TResult? Function( CardPackBuyDto packInfo)? purchasing,TResult? Function( CardPackBuyDto packInfo, String message)? completed,}) {final _that = this; +switch (_that) { +case _Initial() when initial != null: +return initial();case _Loading() when loading != null: +return loading();case _Loaded() when loaded != null: +return loaded(_that.packInfo);case _Error() when error != null: +return error(_that.message);case _Purchasing() when purchasing != null: +return purchasing(_that.packInfo);case _Completed() when completed != null: +return completed(_that.packInfo,_that.message);case _: + return null; + +} } -/// @nodoc -abstract class _$$InitialImplCopyWith<$Res> { - factory _$$InitialImplCopyWith( - _$InitialImpl value, $Res Function(_$InitialImpl) then) = - __$$InitialImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$InitialImplCopyWithImpl<$Res> - extends _$PurchaseStateCopyWithImpl<$Res, _$InitialImpl> - implements _$$InitialImplCopyWith<$Res> { - __$$InitialImplCopyWithImpl( - _$InitialImpl _value, $Res Function(_$InitialImpl) _then) - : super(_value, _then); } /// @nodoc -class _$InitialImpl implements _Initial { - const _$InitialImpl(); - @override - String toString() { - return 'PurchaseState.initial()'; - } +class _Initial implements PurchaseState { + const _Initial(); + - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$InitialImpl); - } - @override - int get hashCode => runtimeType.hashCode; - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function() loading, - required TResult Function(CardPackBuyDto packInfo) loaded, - required TResult Function(String message) error, - required TResult Function(CardPackBuyDto packInfo) purchasing, - required TResult Function(CardPackBuyDto packInfo, String message) - completed, - }) { - return initial(); - } - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function()? loading, - TResult? Function(CardPackBuyDto packInfo)? loaded, - TResult? Function(String message)? error, - TResult? Function(CardPackBuyDto packInfo)? purchasing, - TResult? Function(CardPackBuyDto packInfo, String message)? completed, - }) { - return initial?.call(); - } - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function()? loading, - TResult Function(CardPackBuyDto packInfo)? loaded, - TResult Function(String message)? error, - TResult Function(CardPackBuyDto packInfo)? purchasing, - TResult Function(CardPackBuyDto packInfo, String message)? completed, - required TResult orElse(), - }) { - if (initial != null) { - return initial(); - } - return orElse(); - } - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_Purchasing value) purchasing, - required TResult Function(_Completed value) completed, - }) { - return initial(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_Purchasing value)? purchasing, - TResult? Function(_Completed value)? completed, - }) { - return initial?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_Purchasing value)? purchasing, - TResult Function(_Completed value)? completed, - required TResult orElse(), - }) { - if (initial != null) { - return initial(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Initial); } -abstract class _Initial implements PurchaseState { - const factory _Initial() = _$InitialImpl; + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'PurchaseState.initial()'; +} + + +} + + + + +/// @nodoc + + +class _Loading implements PurchaseState { + const _Loading(); + + + + + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loading); +} + + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'PurchaseState.loading()'; +} + + +} + + + + +/// @nodoc + + +class _Loaded implements PurchaseState { + const _Loaded({required this.packInfo}); + + + final CardPackBuyDto packInfo; + +/// Create a copy of PurchaseState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LoadedCopyWith<_Loaded> get copyWith => __$LoadedCopyWithImpl<_Loaded>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loaded&&(identical(other.packInfo, packInfo) || other.packInfo == packInfo)); +} + + +@override +int get hashCode => Object.hash(runtimeType,packInfo); + +@override +String toString() { + return 'PurchaseState.loaded(packInfo: $packInfo)'; +} + + } /// @nodoc -abstract class _$$LoadingImplCopyWith<$Res> { - factory _$$LoadingImplCopyWith( - _$LoadingImpl value, $Res Function(_$LoadingImpl) then) = - __$$LoadingImplCopyWithImpl<$Res>; +abstract mixin class _$LoadedCopyWith<$Res> implements $PurchaseStateCopyWith<$Res> { + factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl; +@useResult +$Res call({ + CardPackBuyDto packInfo +}); + + + + +} +/// @nodoc +class __$LoadedCopyWithImpl<$Res> + implements _$LoadedCopyWith<$Res> { + __$LoadedCopyWithImpl(this._self, this._then); + + final _Loaded _self; + final $Res Function(_Loaded) _then; + +/// Create a copy of PurchaseState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? packInfo = null,}) { + return _then(_Loaded( +packInfo: null == packInfo ? _self.packInfo : packInfo // ignore: cast_nullable_to_non_nullable +as CardPackBuyDto, + )); } -/// @nodoc -class __$$LoadingImplCopyWithImpl<$Res> - extends _$PurchaseStateCopyWithImpl<$Res, _$LoadingImpl> - implements _$$LoadingImplCopyWith<$Res> { - __$$LoadingImplCopyWithImpl( - _$LoadingImpl _value, $Res Function(_$LoadingImpl) _then) - : super(_value, _then); + } /// @nodoc -class _$LoadingImpl implements _Loading { - const _$LoadingImpl(); - @override - String toString() { - return 'PurchaseState.loading()'; - } +class _Error implements PurchaseState { + const _Error({required this.message}); + - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$LoadingImpl); - } + final String message; - @override - int get hashCode => runtimeType.hashCode; +/// Create a copy of PurchaseState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ErrorCopyWith<_Error> get copyWith => __$ErrorCopyWithImpl<_Error>(this, _$identity); - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function() loading, - required TResult Function(CardPackBuyDto packInfo) loaded, - required TResult Function(String message) error, - required TResult Function(CardPackBuyDto packInfo) purchasing, - required TResult Function(CardPackBuyDto packInfo, String message) - completed, - }) { - return loading(); - } - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function()? loading, - TResult? Function(CardPackBuyDto packInfo)? loaded, - TResult? Function(String message)? error, - TResult? Function(CardPackBuyDto packInfo)? purchasing, - TResult? Function(CardPackBuyDto packInfo, String message)? completed, - }) { - return loading?.call(); - } - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function()? loading, - TResult Function(CardPackBuyDto packInfo)? loaded, - TResult Function(String message)? error, - TResult Function(CardPackBuyDto packInfo)? purchasing, - TResult Function(CardPackBuyDto packInfo, String message)? completed, - required TResult orElse(), - }) { - if (loading != null) { - return loading(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_Purchasing value) purchasing, - required TResult Function(_Completed value) completed, - }) { - return loading(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_Purchasing value)? purchasing, - TResult? Function(_Completed value)? completed, - }) { - return loading?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_Purchasing value)? purchasing, - TResult Function(_Completed value)? completed, - required TResult orElse(), - }) { - if (loading != null) { - return loading(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Error&&(identical(other.message, message) || other.message == message)); } -abstract class _Loading implements PurchaseState { - const factory _Loading() = _$LoadingImpl; + +@override +int get hashCode => Object.hash(runtimeType,message); + +@override +String toString() { + return 'PurchaseState.error(message: $message)'; +} + + } /// @nodoc -abstract class _$$LoadedImplCopyWith<$Res> { - factory _$$LoadedImplCopyWith( - _$LoadedImpl value, $Res Function(_$LoadedImpl) then) = - __$$LoadedImplCopyWithImpl<$Res>; - @useResult - $Res call({CardPackBuyDto packInfo}); +abstract mixin class _$ErrorCopyWith<$Res> implements $PurchaseStateCopyWith<$Res> { + factory _$ErrorCopyWith(_Error value, $Res Function(_Error) _then) = __$ErrorCopyWithImpl; +@useResult +$Res call({ + String message +}); + + + + +} +/// @nodoc +class __$ErrorCopyWithImpl<$Res> + implements _$ErrorCopyWith<$Res> { + __$ErrorCopyWithImpl(this._self, this._then); + + final _Error _self; + final $Res Function(_Error) _then; + +/// Create a copy of PurchaseState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? message = null,}) { + return _then(_Error( +message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -class __$$LoadedImplCopyWithImpl<$Res> - extends _$PurchaseStateCopyWithImpl<$Res, _$LoadedImpl> - implements _$$LoadedImplCopyWith<$Res> { - __$$LoadedImplCopyWithImpl( - _$LoadedImpl _value, $Res Function(_$LoadedImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? packInfo = null, - }) { - return _then(_$LoadedImpl( - packInfo: null == packInfo - ? _value.packInfo - : packInfo // ignore: cast_nullable_to_non_nullable - as CardPackBuyDto, - )); - } } /// @nodoc -class _$LoadedImpl implements _Loaded { - const _$LoadedImpl({required this.packInfo}); - @override - final CardPackBuyDto packInfo; +class _Purchasing implements PurchaseState { + const _Purchasing({required this.packInfo}); + - @override - String toString() { - return 'PurchaseState.loaded(packInfo: $packInfo)'; - } + final CardPackBuyDto packInfo; - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$LoadedImpl && - (identical(other.packInfo, packInfo) || - other.packInfo == packInfo)); - } +/// Create a copy of PurchaseState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PurchasingCopyWith<_Purchasing> get copyWith => __$PurchasingCopyWithImpl<_Purchasing>(this, _$identity); - @override - int get hashCode => Object.hash(runtimeType, packInfo); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - __$$LoadedImplCopyWithImpl<_$LoadedImpl>(this, _$identity); - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function() loading, - required TResult Function(CardPackBuyDto packInfo) loaded, - required TResult Function(String message) error, - required TResult Function(CardPackBuyDto packInfo) purchasing, - required TResult Function(CardPackBuyDto packInfo, String message) - completed, - }) { - return loaded(packInfo); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function()? loading, - TResult? Function(CardPackBuyDto packInfo)? loaded, - TResult? Function(String message)? error, - TResult? Function(CardPackBuyDto packInfo)? purchasing, - TResult? Function(CardPackBuyDto packInfo, String message)? completed, - }) { - return loaded?.call(packInfo); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function()? loading, - TResult Function(CardPackBuyDto packInfo)? loaded, - TResult Function(String message)? error, - TResult Function(CardPackBuyDto packInfo)? purchasing, - TResult Function(CardPackBuyDto packInfo, String message)? completed, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(packInfo); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_Purchasing value) purchasing, - required TResult Function(_Completed value) completed, - }) { - return loaded(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_Purchasing value)? purchasing, - TResult? Function(_Completed value)? completed, - }) { - return loaded?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_Purchasing value)? purchasing, - TResult Function(_Completed value)? completed, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Purchasing&&(identical(other.packInfo, packInfo) || other.packInfo == packInfo)); +} + + +@override +int get hashCode => Object.hash(runtimeType,packInfo); + +@override +String toString() { + return 'PurchaseState.purchasing(packInfo: $packInfo)'; } -abstract class _Loaded implements PurchaseState { - const factory _Loaded({required final CardPackBuyDto packInfo}) = - _$LoadedImpl; - CardPackBuyDto get packInfo; - @JsonKey(ignore: true) - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$ErrorImplCopyWith<$Res> { - factory _$$ErrorImplCopyWith( - _$ErrorImpl value, $Res Function(_$ErrorImpl) then) = - __$$ErrorImplCopyWithImpl<$Res>; - @useResult - $Res call({String message}); +abstract mixin class _$PurchasingCopyWith<$Res> implements $PurchaseStateCopyWith<$Res> { + factory _$PurchasingCopyWith(_Purchasing value, $Res Function(_Purchasing) _then) = __$PurchasingCopyWithImpl; +@useResult +$Res call({ + CardPackBuyDto packInfo +}); + + + + +} +/// @nodoc +class __$PurchasingCopyWithImpl<$Res> + implements _$PurchasingCopyWith<$Res> { + __$PurchasingCopyWithImpl(this._self, this._then); + + final _Purchasing _self; + final $Res Function(_Purchasing) _then; + +/// Create a copy of PurchaseState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? packInfo = null,}) { + return _then(_Purchasing( +packInfo: null == packInfo ? _self.packInfo : packInfo // ignore: cast_nullable_to_non_nullable +as CardPackBuyDto, + )); } -/// @nodoc -class __$$ErrorImplCopyWithImpl<$Res> - extends _$PurchaseStateCopyWithImpl<$Res, _$ErrorImpl> - implements _$$ErrorImplCopyWith<$Res> { - __$$ErrorImplCopyWithImpl( - _$ErrorImpl _value, $Res Function(_$ErrorImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? message = null, - }) { - return _then(_$ErrorImpl( - message: null == message - ? _value.message - : message // ignore: cast_nullable_to_non_nullable - as String, - )); - } } /// @nodoc -class _$ErrorImpl implements _Error { - const _$ErrorImpl({required this.message}); - @override - final String message; +class _Completed implements PurchaseState { + const _Completed({required this.packInfo, required this.message}); + - @override - String toString() { - return 'PurchaseState.error(message: $message)'; - } + final CardPackBuyDto packInfo; + final String message; - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ErrorImpl && - (identical(other.message, message) || other.message == message)); - } +/// Create a copy of PurchaseState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$CompletedCopyWith<_Completed> get copyWith => __$CompletedCopyWithImpl<_Completed>(this, _$identity); - @override - int get hashCode => Object.hash(runtimeType, message); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => - __$$ErrorImplCopyWithImpl<_$ErrorImpl>(this, _$identity); - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function() loading, - required TResult Function(CardPackBuyDto packInfo) loaded, - required TResult Function(String message) error, - required TResult Function(CardPackBuyDto packInfo) purchasing, - required TResult Function(CardPackBuyDto packInfo, String message) - completed, - }) { - return error(message); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function()? loading, - TResult? Function(CardPackBuyDto packInfo)? loaded, - TResult? Function(String message)? error, - TResult? Function(CardPackBuyDto packInfo)? purchasing, - TResult? Function(CardPackBuyDto packInfo, String message)? completed, - }) { - return error?.call(message); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function()? loading, - TResult Function(CardPackBuyDto packInfo)? loaded, - TResult Function(String message)? error, - TResult Function(CardPackBuyDto packInfo)? purchasing, - TResult Function(CardPackBuyDto packInfo, String message)? completed, - required TResult orElse(), - }) { - if (error != null) { - return error(message); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_Purchasing value) purchasing, - required TResult Function(_Completed value) completed, - }) { - return error(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_Purchasing value)? purchasing, - TResult? Function(_Completed value)? completed, - }) { - return error?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_Purchasing value)? purchasing, - TResult Function(_Completed value)? completed, - required TResult orElse(), - }) { - if (error != null) { - return error(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Completed&&(identical(other.packInfo, packInfo) || other.packInfo == packInfo)&&(identical(other.message, message) || other.message == message)); +} + + +@override +int get hashCode => Object.hash(runtimeType,packInfo,message); + +@override +String toString() { + return 'PurchaseState.completed(packInfo: $packInfo, message: $message)'; } -abstract class _Error implements PurchaseState { - const factory _Error({required final String message}) = _$ErrorImpl; - String get message; - @JsonKey(ignore: true) - _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$PurchasingImplCopyWith<$Res> { - factory _$$PurchasingImplCopyWith( - _$PurchasingImpl value, $Res Function(_$PurchasingImpl) then) = - __$$PurchasingImplCopyWithImpl<$Res>; - @useResult - $Res call({CardPackBuyDto packInfo}); -} +abstract mixin class _$CompletedCopyWith<$Res> implements $PurchaseStateCopyWith<$Res> { + factory _$CompletedCopyWith(_Completed value, $Res Function(_Completed) _then) = __$CompletedCopyWithImpl; +@useResult +$Res call({ + CardPackBuyDto packInfo, String message +}); + + + +} /// @nodoc -class __$$PurchasingImplCopyWithImpl<$Res> - extends _$PurchaseStateCopyWithImpl<$Res, _$PurchasingImpl> - implements _$$PurchasingImplCopyWith<$Res> { - __$$PurchasingImplCopyWithImpl( - _$PurchasingImpl _value, $Res Function(_$PurchasingImpl) _then) - : super(_value, _then); +class __$CompletedCopyWithImpl<$Res> + implements _$CompletedCopyWith<$Res> { + __$CompletedCopyWithImpl(this._self, this._then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? packInfo = null, - }) { - return _then(_$PurchasingImpl( - packInfo: null == packInfo - ? _value.packInfo - : packInfo // ignore: cast_nullable_to_non_nullable - as CardPackBuyDto, - )); - } + final _Completed _self; + final $Res Function(_Completed) _then; + +/// Create a copy of PurchaseState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? packInfo = null,Object? message = null,}) { + return _then(_Completed( +packInfo: null == packInfo ? _self.packInfo : packInfo // ignore: cast_nullable_to_non_nullable +as CardPackBuyDto,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -class _$PurchasingImpl implements _Purchasing { - const _$PurchasingImpl({required this.packInfo}); - - @override - final CardPackBuyDto packInfo; - - @override - String toString() { - return 'PurchaseState.purchasing(packInfo: $packInfo)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$PurchasingImpl && - (identical(other.packInfo, packInfo) || - other.packInfo == packInfo)); - } - - @override - int get hashCode => Object.hash(runtimeType, packInfo); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$PurchasingImplCopyWith<_$PurchasingImpl> get copyWith => - __$$PurchasingImplCopyWithImpl<_$PurchasingImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function() loading, - required TResult Function(CardPackBuyDto packInfo) loaded, - required TResult Function(String message) error, - required TResult Function(CardPackBuyDto packInfo) purchasing, - required TResult Function(CardPackBuyDto packInfo, String message) - completed, - }) { - return purchasing(packInfo); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function()? loading, - TResult? Function(CardPackBuyDto packInfo)? loaded, - TResult? Function(String message)? error, - TResult? Function(CardPackBuyDto packInfo)? purchasing, - TResult? Function(CardPackBuyDto packInfo, String message)? completed, - }) { - return purchasing?.call(packInfo); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function()? loading, - TResult Function(CardPackBuyDto packInfo)? loaded, - TResult Function(String message)? error, - TResult Function(CardPackBuyDto packInfo)? purchasing, - TResult Function(CardPackBuyDto packInfo, String message)? completed, - required TResult orElse(), - }) { - if (purchasing != null) { - return purchasing(packInfo); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_Purchasing value) purchasing, - required TResult Function(_Completed value) completed, - }) { - return purchasing(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_Purchasing value)? purchasing, - TResult? Function(_Completed value)? completed, - }) { - return purchasing?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_Purchasing value)? purchasing, - TResult Function(_Completed value)? completed, - required TResult orElse(), - }) { - if (purchasing != null) { - return purchasing(this); - } - return orElse(); - } } -abstract class _Purchasing implements PurchaseState { - const factory _Purchasing({required final CardPackBuyDto packInfo}) = - _$PurchasingImpl; - - CardPackBuyDto get packInfo; - @JsonKey(ignore: true) - _$$PurchasingImplCopyWith<_$PurchasingImpl> get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class _$$CompletedImplCopyWith<$Res> { - factory _$$CompletedImplCopyWith( - _$CompletedImpl value, $Res Function(_$CompletedImpl) then) = - __$$CompletedImplCopyWithImpl<$Res>; - @useResult - $Res call({CardPackBuyDto packInfo, String message}); -} - -/// @nodoc -class __$$CompletedImplCopyWithImpl<$Res> - extends _$PurchaseStateCopyWithImpl<$Res, _$CompletedImpl> - implements _$$CompletedImplCopyWith<$Res> { - __$$CompletedImplCopyWithImpl( - _$CompletedImpl _value, $Res Function(_$CompletedImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? packInfo = null, - Object? message = null, - }) { - return _then(_$CompletedImpl( - packInfo: null == packInfo - ? _value.packInfo - : packInfo // ignore: cast_nullable_to_non_nullable - as CardPackBuyDto, - message: null == message - ? _value.message - : message // ignore: cast_nullable_to_non_nullable - as String, - )); - } -} - -/// @nodoc - -class _$CompletedImpl implements _Completed { - const _$CompletedImpl({required this.packInfo, required this.message}); - - @override - final CardPackBuyDto packInfo; - @override - final String message; - - @override - String toString() { - return 'PurchaseState.completed(packInfo: $packInfo, message: $message)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$CompletedImpl && - (identical(other.packInfo, packInfo) || - other.packInfo == packInfo) && - (identical(other.message, message) || other.message == message)); - } - - @override - int get hashCode => Object.hash(runtimeType, packInfo, message); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$CompletedImplCopyWith<_$CompletedImpl> get copyWith => - __$$CompletedImplCopyWithImpl<_$CompletedImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() initial, - required TResult Function() loading, - required TResult Function(CardPackBuyDto packInfo) loaded, - required TResult Function(String message) error, - required TResult Function(CardPackBuyDto packInfo) purchasing, - required TResult Function(CardPackBuyDto packInfo, String message) - completed, - }) { - return completed(packInfo, message); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? initial, - TResult? Function()? loading, - TResult? Function(CardPackBuyDto packInfo)? loaded, - TResult? Function(String message)? error, - TResult? Function(CardPackBuyDto packInfo)? purchasing, - TResult? Function(CardPackBuyDto packInfo, String message)? completed, - }) { - return completed?.call(packInfo, message); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? initial, - TResult Function()? loading, - TResult Function(CardPackBuyDto packInfo)? loaded, - TResult Function(String message)? error, - TResult Function(CardPackBuyDto packInfo)? purchasing, - TResult Function(CardPackBuyDto packInfo, String message)? completed, - required TResult orElse(), - }) { - if (completed != null) { - return completed(packInfo, message); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Initial value) initial, - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_Purchasing value) purchasing, - required TResult Function(_Completed value) completed, - }) { - return completed(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Initial value)? initial, - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_Purchasing value)? purchasing, - TResult? Function(_Completed value)? completed, - }) { - return completed?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Initial value)? initial, - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_Purchasing value)? purchasing, - TResult Function(_Completed value)? completed, - required TResult orElse(), - }) { - if (completed != null) { - return completed(this); - } - return orElse(); - } -} - -abstract class _Completed implements PurchaseState { - const factory _Completed( - {required final CardPackBuyDto packInfo, - required final String message}) = _$CompletedImpl; - - CardPackBuyDto get packInfo; - String get message; - @JsonKey(ignore: true) - _$$CompletedImplCopyWith<_$CompletedImpl> get copyWith => - throw _privateConstructorUsedError; -} +// dart format on diff --git a/mnemo_cards_web_v2/lib/domain/state/tests_state_manager.freezed.dart b/mnemo_cards_web_v2/lib/domain/state/tests_state_manager.freezed.dart index 84c1b08..26f553f 100644 --- a/mnemo_cards_web_v2/lib/domain/state/tests_state_manager.freezed.dart +++ b/mnemo_cards_web_v2/lib/domain/state/tests_state_manager.freezed.dart @@ -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,1454 +9,623 @@ part of 'tests_state_manager.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - /// @nodoc mixin _$TestsState { - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function(List tests, String packId) loaded, - required TResult Function(String message) error, - required TResult Function(TestDto test, List questions) - gameSessionPreparing, - required TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay) - gameSessionActive, - required TResult Function(TestDto test, GameSessionResult result) - gameSessionCompleted, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List tests, String packId)? loaded, - TResult? Function(String message)? error, - TResult? Function(TestDto test, List questions)? - gameSessionPreparing, - TResult? Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult? Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List tests, String packId)? loaded, - TResult Function(String message)? error, - TResult Function(TestDto test, List questions)? - gameSessionPreparing, - TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_GameSessionPreparing value) gameSessionPreparing, - required TResult Function(_GameSessionActive value) gameSessionActive, - required TResult Function(_GameSessionCompleted value) gameSessionCompleted, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult? Function(_GameSessionActive value)? gameSessionActive, - TResult? Function(_GameSessionCompleted value)? gameSessionCompleted, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult Function(_GameSessionActive value)? gameSessionActive, - TResult Function(_GameSessionCompleted value)? gameSessionCompleted, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; + + + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is TestsState); +} + + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'TestsState()'; +} + + } /// @nodoc -abstract class $TestsStateCopyWith<$Res> { - factory $TestsStateCopyWith( - TestsState value, $Res Function(TestsState) then) = - _$TestsStateCopyWithImpl<$Res, TestsState>; +class $TestsStateCopyWith<$Res> { +$TestsStateCopyWith(TestsState _, $Res Function(TestsState) __); } -/// @nodoc -class _$TestsStateCopyWithImpl<$Res, $Val extends TestsState> - implements $TestsStateCopyWith<$Res> { - _$TestsStateCopyWithImpl(this._value, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; +/// Adds pattern-matching-related methods to [TestsState]. +extension TestsStatePatterns on TestsState { +/// 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 Function( _Loading value)? loading,TResult Function( _Loaded value)? loaded,TResult Function( _Error value)? error,TResult Function( _GameSessionPreparing value)? gameSessionPreparing,TResult Function( _GameSessionActive value)? gameSessionActive,TResult Function( _GameSessionCompleted value)? gameSessionCompleted,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading(_that);case _Loaded() when loaded != null: +return loaded(_that);case _Error() when error != null: +return error(_that);case _GameSessionPreparing() when gameSessionPreparing != null: +return gameSessionPreparing(_that);case _GameSessionActive() when gameSessionActive != null: +return gameSessionActive(_that);case _GameSessionCompleted() when gameSessionCompleted != null: +return gameSessionCompleted(_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({required TResult Function( _Loading value) loading,required TResult Function( _Loaded value) loaded,required TResult Function( _Error value) error,required TResult Function( _GameSessionPreparing value) gameSessionPreparing,required TResult Function( _GameSessionActive value) gameSessionActive,required TResult Function( _GameSessionCompleted value) gameSessionCompleted,}){ +final _that = this; +switch (_that) { +case _Loading(): +return loading(_that);case _Loaded(): +return loaded(_that);case _Error(): +return error(_that);case _GameSessionPreparing(): +return gameSessionPreparing(_that);case _GameSessionActive(): +return gameSessionActive(_that);case _GameSessionCompleted(): +return gameSessionCompleted(_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? Function( _Loading value)? loading,TResult? Function( _Loaded value)? loaded,TResult? Function( _Error value)? error,TResult? Function( _GameSessionPreparing value)? gameSessionPreparing,TResult? Function( _GameSessionActive value)? gameSessionActive,TResult? Function( _GameSessionCompleted value)? gameSessionCompleted,}){ +final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading(_that);case _Loaded() when loaded != null: +return loaded(_that);case _Error() when error != null: +return error(_that);case _GameSessionPreparing() when gameSessionPreparing != null: +return gameSessionPreparing(_that);case _GameSessionActive() when gameSessionActive != null: +return gameSessionActive(_that);case _GameSessionCompleted() when gameSessionCompleted != null: +return gameSessionCompleted(_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 Function()? loading,TResult Function( List tests, String packId)? loaded,TResult Function( String message)? error,TResult Function( TestDto test, List questions)? gameSessionPreparing,TResult Function( TestDto test, List questions, int currentQuestionIndex, GameSessionResult? currentResult, Map questionResults, bool isAnswerSubmitted, bool isCorrect, Duration? answerFeedbackDelay)? gameSessionActive,TResult Function( TestDto test, GameSessionResult result)? gameSessionCompleted,required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading();case _Loaded() when loaded != null: +return loaded(_that.tests,_that.packId);case _Error() when error != null: +return error(_that.message);case _GameSessionPreparing() when gameSessionPreparing != null: +return gameSessionPreparing(_that.test,_that.questions);case _GameSessionActive() when gameSessionActive != null: +return gameSessionActive(_that.test,_that.questions,_that.currentQuestionIndex,_that.currentResult,_that.questionResults,_that.isAnswerSubmitted,_that.isCorrect,_that.answerFeedbackDelay);case _GameSessionCompleted() when gameSessionCompleted != null: +return gameSessionCompleted(_that.test,_that.result);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({required TResult Function() loading,required TResult Function( List tests, String packId) loaded,required TResult Function( String message) error,required TResult Function( TestDto test, List questions) gameSessionPreparing,required TResult Function( TestDto test, List questions, int currentQuestionIndex, GameSessionResult? currentResult, Map questionResults, bool isAnswerSubmitted, bool isCorrect, Duration? answerFeedbackDelay) gameSessionActive,required TResult Function( TestDto test, GameSessionResult result) gameSessionCompleted,}) {final _that = this; +switch (_that) { +case _Loading(): +return loading();case _Loaded(): +return loaded(_that.tests,_that.packId);case _Error(): +return error(_that.message);case _GameSessionPreparing(): +return gameSessionPreparing(_that.test,_that.questions);case _GameSessionActive(): +return gameSessionActive(_that.test,_that.questions,_that.currentQuestionIndex,_that.currentResult,_that.questionResults,_that.isAnswerSubmitted,_that.isCorrect,_that.answerFeedbackDelay);case _GameSessionCompleted(): +return gameSessionCompleted(_that.test,_that.result);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? Function()? loading,TResult? Function( List tests, String packId)? loaded,TResult? Function( String message)? error,TResult? Function( TestDto test, List questions)? gameSessionPreparing,TResult? Function( TestDto test, List questions, int currentQuestionIndex, GameSessionResult? currentResult, Map questionResults, bool isAnswerSubmitted, bool isCorrect, Duration? answerFeedbackDelay)? gameSessionActive,TResult? Function( TestDto test, GameSessionResult result)? gameSessionCompleted,}) {final _that = this; +switch (_that) { +case _Loading() when loading != null: +return loading();case _Loaded() when loaded != null: +return loaded(_that.tests,_that.packId);case _Error() when error != null: +return error(_that.message);case _GameSessionPreparing() when gameSessionPreparing != null: +return gameSessionPreparing(_that.test,_that.questions);case _GameSessionActive() when gameSessionActive != null: +return gameSessionActive(_that.test,_that.questions,_that.currentQuestionIndex,_that.currentResult,_that.questionResults,_that.isAnswerSubmitted,_that.isCorrect,_that.answerFeedbackDelay);case _GameSessionCompleted() when gameSessionCompleted != null: +return gameSessionCompleted(_that.test,_that.result);case _: + return null; + +} } -/// @nodoc -abstract class _$$LoadingImplCopyWith<$Res> { - factory _$$LoadingImplCopyWith( - _$LoadingImpl value, $Res Function(_$LoadingImpl) then) = - __$$LoadingImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$LoadingImplCopyWithImpl<$Res> - extends _$TestsStateCopyWithImpl<$Res, _$LoadingImpl> - implements _$$LoadingImplCopyWith<$Res> { - __$$LoadingImplCopyWithImpl( - _$LoadingImpl _value, $Res Function(_$LoadingImpl) _then) - : super(_value, _then); } /// @nodoc -class _$LoadingImpl implements _Loading { - const _$LoadingImpl(); - @override - String toString() { - return 'TestsState.loading()'; - } +class _Loading implements TestsState { + const _Loading(); + - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$LoadingImpl); - } - @override - int get hashCode => runtimeType.hashCode; - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function(List tests, String packId) loaded, - required TResult Function(String message) error, - required TResult Function(TestDto test, List questions) - gameSessionPreparing, - required TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay) - gameSessionActive, - required TResult Function(TestDto test, GameSessionResult result) - gameSessionCompleted, - }) { - return loading(); - } - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List tests, String packId)? loaded, - TResult? Function(String message)? error, - TResult? Function(TestDto test, List questions)? - gameSessionPreparing, - TResult? Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult? Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - }) { - return loading?.call(); - } - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List tests, String packId)? loaded, - TResult Function(String message)? error, - TResult Function(TestDto test, List questions)? - gameSessionPreparing, - TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - required TResult orElse(), - }) { - if (loading != null) { - return loading(); - } - return orElse(); - } - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_GameSessionPreparing value) gameSessionPreparing, - required TResult Function(_GameSessionActive value) gameSessionActive, - required TResult Function(_GameSessionCompleted value) gameSessionCompleted, - }) { - return loading(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult? Function(_GameSessionActive value)? gameSessionActive, - TResult? Function(_GameSessionCompleted value)? gameSessionCompleted, - }) { - return loading?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult Function(_GameSessionActive value)? gameSessionActive, - TResult Function(_GameSessionCompleted value)? gameSessionCompleted, - required TResult orElse(), - }) { - if (loading != null) { - return loading(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loading); } -abstract class _Loading implements TestsState { - const factory _Loading() = _$LoadingImpl; + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'TestsState.loading()'; +} + + +} + + + + +/// @nodoc + + +class _Loaded implements TestsState { + const _Loaded({required final List tests, required this.packId}): _tests = tests; + + + final List _tests; + List get tests { + if (_tests is EqualUnmodifiableListView) return _tests; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_tests); +} + + final String packId; + +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LoadedCopyWith<_Loaded> get copyWith => __$LoadedCopyWithImpl<_Loaded>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loaded&&const DeepCollectionEquality().equals(other._tests, _tests)&&(identical(other.packId, packId) || other.packId == packId)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_tests),packId); + +@override +String toString() { + return 'TestsState.loaded(tests: $tests, packId: $packId)'; +} + + } /// @nodoc -abstract class _$$LoadedImplCopyWith<$Res> { - factory _$$LoadedImplCopyWith( - _$LoadedImpl value, $Res Function(_$LoadedImpl) then) = - __$$LoadedImplCopyWithImpl<$Res>; - @useResult - $Res call({List tests, String packId}); +abstract mixin class _$LoadedCopyWith<$Res> implements $TestsStateCopyWith<$Res> { + factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl; +@useResult +$Res call({ + List tests, String packId +}); + + + + +} +/// @nodoc +class __$LoadedCopyWithImpl<$Res> + implements _$LoadedCopyWith<$Res> { + __$LoadedCopyWithImpl(this._self, this._then); + + final _Loaded _self; + final $Res Function(_Loaded) _then; + +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? tests = null,Object? packId = null,}) { + return _then(_Loaded( +tests: null == tests ? _self._tests : tests // ignore: cast_nullable_to_non_nullable +as List,packId: null == packId ? _self.packId : packId // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -class __$$LoadedImplCopyWithImpl<$Res> - extends _$TestsStateCopyWithImpl<$Res, _$LoadedImpl> - implements _$$LoadedImplCopyWith<$Res> { - __$$LoadedImplCopyWithImpl( - _$LoadedImpl _value, $Res Function(_$LoadedImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? tests = null, - Object? packId = null, - }) { - return _then(_$LoadedImpl( - tests: null == tests - ? _value._tests - : tests // ignore: cast_nullable_to_non_nullable - as List, - packId: null == packId - ? _value.packId - : packId // ignore: cast_nullable_to_non_nullable - as String, - )); - } } /// @nodoc -class _$LoadedImpl implements _Loaded { - const _$LoadedImpl({required final List tests, required this.packId}) - : _tests = tests; - final List _tests; - @override - List get tests { - if (_tests is EqualUnmodifiableListView) return _tests; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_tests); - } +class _Error implements TestsState { + const _Error(this.message); + - @override - final String packId; + final String message; - @override - String toString() { - return 'TestsState.loaded(tests: $tests, packId: $packId)'; - } +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ErrorCopyWith<_Error> get copyWith => __$ErrorCopyWithImpl<_Error>(this, _$identity); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$LoadedImpl && - const DeepCollectionEquality().equals(other._tests, _tests) && - (identical(other.packId, packId) || other.packId == packId)); - } - @override - int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_tests), packId); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - __$$LoadedImplCopyWithImpl<_$LoadedImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function(List tests, String packId) loaded, - required TResult Function(String message) error, - required TResult Function(TestDto test, List questions) - gameSessionPreparing, - required TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay) - gameSessionActive, - required TResult Function(TestDto test, GameSessionResult result) - gameSessionCompleted, - }) { - return loaded(tests, packId); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List tests, String packId)? loaded, - TResult? Function(String message)? error, - TResult? Function(TestDto test, List questions)? - gameSessionPreparing, - TResult? Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult? Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - }) { - return loaded?.call(tests, packId); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List tests, String packId)? loaded, - TResult Function(String message)? error, - TResult Function(TestDto test, List questions)? - gameSessionPreparing, - TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(tests, packId); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_GameSessionPreparing value) gameSessionPreparing, - required TResult Function(_GameSessionActive value) gameSessionActive, - required TResult Function(_GameSessionCompleted value) gameSessionCompleted, - }) { - return loaded(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult? Function(_GameSessionActive value)? gameSessionActive, - TResult? Function(_GameSessionCompleted value)? gameSessionCompleted, - }) { - return loaded?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult Function(_GameSessionActive value)? gameSessionActive, - TResult Function(_GameSessionCompleted value)? gameSessionCompleted, - required TResult orElse(), - }) { - if (loaded != null) { - return loaded(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Error&&(identical(other.message, message) || other.message == message)); +} + + +@override +int get hashCode => Object.hash(runtimeType,message); + +@override +String toString() { + return 'TestsState.error(message: $message)'; } -abstract class _Loaded implements TestsState { - const factory _Loaded( - {required final List tests, - required final String packId}) = _$LoadedImpl; - List get tests; - String get packId; - @JsonKey(ignore: true) - _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$ErrorImplCopyWith<$Res> { - factory _$$ErrorImplCopyWith( - _$ErrorImpl value, $Res Function(_$ErrorImpl) then) = - __$$ErrorImplCopyWithImpl<$Res>; - @useResult - $Res call({String message}); +abstract mixin class _$ErrorCopyWith<$Res> implements $TestsStateCopyWith<$Res> { + factory _$ErrorCopyWith(_Error value, $Res Function(_Error) _then) = __$ErrorCopyWithImpl; +@useResult +$Res call({ + String message +}); + + + + +} +/// @nodoc +class __$ErrorCopyWithImpl<$Res> + implements _$ErrorCopyWith<$Res> { + __$ErrorCopyWithImpl(this._self, this._then); + + final _Error _self; + final $Res Function(_Error) _then; + +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? message = null,}) { + return _then(_Error( +null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable +as String, + )); } -/// @nodoc -class __$$ErrorImplCopyWithImpl<$Res> - extends _$TestsStateCopyWithImpl<$Res, _$ErrorImpl> - implements _$$ErrorImplCopyWith<$Res> { - __$$ErrorImplCopyWithImpl( - _$ErrorImpl _value, $Res Function(_$ErrorImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? message = null, - }) { - return _then(_$ErrorImpl( - null == message - ? _value.message - : message // ignore: cast_nullable_to_non_nullable - as String, - )); - } } /// @nodoc -class _$ErrorImpl implements _Error { - const _$ErrorImpl(this.message); - @override - final String message; +class _GameSessionPreparing implements TestsState { + const _GameSessionPreparing({required this.test, required final List questions}): _questions = questions; + - @override - String toString() { - return 'TestsState.error(message: $message)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ErrorImpl && - (identical(other.message, message) || other.message == message)); - } - - @override - int get hashCode => Object.hash(runtimeType, message); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => - __$$ErrorImplCopyWithImpl<_$ErrorImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function(List tests, String packId) loaded, - required TResult Function(String message) error, - required TResult Function(TestDto test, List questions) - gameSessionPreparing, - required TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay) - gameSessionActive, - required TResult Function(TestDto test, GameSessionResult result) - gameSessionCompleted, - }) { - return error(message); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List tests, String packId)? loaded, - TResult? Function(String message)? error, - TResult? Function(TestDto test, List questions)? - gameSessionPreparing, - TResult? Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult? Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - }) { - return error?.call(message); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List tests, String packId)? loaded, - TResult Function(String message)? error, - TResult Function(TestDto test, List questions)? - gameSessionPreparing, - TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - required TResult orElse(), - }) { - if (error != null) { - return error(message); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_GameSessionPreparing value) gameSessionPreparing, - required TResult Function(_GameSessionActive value) gameSessionActive, - required TResult Function(_GameSessionCompleted value) gameSessionCompleted, - }) { - return error(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult? Function(_GameSessionActive value)? gameSessionActive, - TResult? Function(_GameSessionCompleted value)? gameSessionCompleted, - }) { - return error?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult Function(_GameSessionActive value)? gameSessionActive, - TResult Function(_GameSessionCompleted value)? gameSessionCompleted, - required TResult orElse(), - }) { - if (error != null) { - return error(this); - } - return orElse(); - } + final TestDto test; + final List _questions; + List get questions { + if (_questions is EqualUnmodifiableListView) return _questions; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_questions); +} + + +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GameSessionPreparingCopyWith<_GameSessionPreparing> get copyWith => __$GameSessionPreparingCopyWithImpl<_GameSessionPreparing>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GameSessionPreparing&&(identical(other.test, test) || other.test == test)&&const DeepCollectionEquality().equals(other._questions, _questions)); +} + + +@override +int get hashCode => Object.hash(runtimeType,test,const DeepCollectionEquality().hash(_questions)); + +@override +String toString() { + return 'TestsState.gameSessionPreparing(test: $test, questions: $questions)'; } -abstract class _Error implements TestsState { - const factory _Error(final String message) = _$ErrorImpl; - String get message; - @JsonKey(ignore: true) - _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$GameSessionPreparingImplCopyWith<$Res> { - factory _$$GameSessionPreparingImplCopyWith(_$GameSessionPreparingImpl value, - $Res Function(_$GameSessionPreparingImpl) then) = - __$$GameSessionPreparingImplCopyWithImpl<$Res>; - @useResult - $Res call({TestDto test, List questions}); +abstract mixin class _$GameSessionPreparingCopyWith<$Res> implements $TestsStateCopyWith<$Res> { + factory _$GameSessionPreparingCopyWith(_GameSessionPreparing value, $Res Function(_GameSessionPreparing) _then) = __$GameSessionPreparingCopyWithImpl; +@useResult +$Res call({ + TestDto test, List questions +}); + + + + +} +/// @nodoc +class __$GameSessionPreparingCopyWithImpl<$Res> + implements _$GameSessionPreparingCopyWith<$Res> { + __$GameSessionPreparingCopyWithImpl(this._self, this._then); + + final _GameSessionPreparing _self; + final $Res Function(_GameSessionPreparing) _then; + +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? test = null,Object? questions = null,}) { + return _then(_GameSessionPreparing( +test: null == test ? _self.test : test // ignore: cast_nullable_to_non_nullable +as TestDto,questions: null == questions ? _self._questions : questions // ignore: cast_nullable_to_non_nullable +as List, + )); } -/// @nodoc -class __$$GameSessionPreparingImplCopyWithImpl<$Res> - extends _$TestsStateCopyWithImpl<$Res, _$GameSessionPreparingImpl> - implements _$$GameSessionPreparingImplCopyWith<$Res> { - __$$GameSessionPreparingImplCopyWithImpl(_$GameSessionPreparingImpl _value, - $Res Function(_$GameSessionPreparingImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? test = null, - Object? questions = null, - }) { - return _then(_$GameSessionPreparingImpl( - test: null == test - ? _value.test - : test // ignore: cast_nullable_to_non_nullable - as TestDto, - questions: null == questions - ? _value._questions - : questions // ignore: cast_nullable_to_non_nullable - as List, - )); - } } /// @nodoc -class _$GameSessionPreparingImpl implements _GameSessionPreparing { - const _$GameSessionPreparingImpl( - {required this.test, required final List questions}) - : _questions = questions; - @override - final TestDto test; - final List _questions; - @override - List get questions { - if (_questions is EqualUnmodifiableListView) return _questions; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_questions); - } +class _GameSessionActive implements TestsState { + const _GameSessionActive({required this.test, required final List questions, required this.currentQuestionIndex, required this.currentResult, required final Map questionResults, required this.isAnswerSubmitted, required this.isCorrect, this.answerFeedbackDelay}): _questions = questions,_questionResults = questionResults; + - @override - String toString() { - return 'TestsState.gameSessionPreparing(test: $test, questions: $questions)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$GameSessionPreparingImpl && - (identical(other.test, test) || other.test == test) && - const DeepCollectionEquality() - .equals(other._questions, _questions)); - } - - @override - int get hashCode => Object.hash( - runtimeType, test, const DeepCollectionEquality().hash(_questions)); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$GameSessionPreparingImplCopyWith<_$GameSessionPreparingImpl> - get copyWith => - __$$GameSessionPreparingImplCopyWithImpl<_$GameSessionPreparingImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function(List tests, String packId) loaded, - required TResult Function(String message) error, - required TResult Function(TestDto test, List questions) - gameSessionPreparing, - required TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay) - gameSessionActive, - required TResult Function(TestDto test, GameSessionResult result) - gameSessionCompleted, - }) { - return gameSessionPreparing(test, questions); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List tests, String packId)? loaded, - TResult? Function(String message)? error, - TResult? Function(TestDto test, List questions)? - gameSessionPreparing, - TResult? Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult? Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - }) { - return gameSessionPreparing?.call(test, questions); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List tests, String packId)? loaded, - TResult Function(String message)? error, - TResult Function(TestDto test, List questions)? - gameSessionPreparing, - TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - required TResult orElse(), - }) { - if (gameSessionPreparing != null) { - return gameSessionPreparing(test, questions); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_GameSessionPreparing value) gameSessionPreparing, - required TResult Function(_GameSessionActive value) gameSessionActive, - required TResult Function(_GameSessionCompleted value) gameSessionCompleted, - }) { - return gameSessionPreparing(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult? Function(_GameSessionActive value)? gameSessionActive, - TResult? Function(_GameSessionCompleted value)? gameSessionCompleted, - }) { - return gameSessionPreparing?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult Function(_GameSessionActive value)? gameSessionActive, - TResult Function(_GameSessionCompleted value)? gameSessionCompleted, - required TResult orElse(), - }) { - if (gameSessionPreparing != null) { - return gameSessionPreparing(this); - } - return orElse(); - } + final TestDto test; + final List _questions; + List get questions { + if (_questions is EqualUnmodifiableListView) return _questions; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_questions); +} + + final int currentQuestionIndex; + final GameSessionResult? currentResult; + final Map _questionResults; + Map get questionResults { + if (_questionResults is EqualUnmodifiableMapView) return _questionResults; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_questionResults); +} + + final bool isAnswerSubmitted; + final bool isCorrect; + final Duration? answerFeedbackDelay; + +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GameSessionActiveCopyWith<_GameSessionActive> get copyWith => __$GameSessionActiveCopyWithImpl<_GameSessionActive>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GameSessionActive&&(identical(other.test, test) || other.test == test)&&const DeepCollectionEquality().equals(other._questions, _questions)&&(identical(other.currentQuestionIndex, currentQuestionIndex) || other.currentQuestionIndex == currentQuestionIndex)&&(identical(other.currentResult, currentResult) || other.currentResult == currentResult)&&const DeepCollectionEquality().equals(other._questionResults, _questionResults)&&(identical(other.isAnswerSubmitted, isAnswerSubmitted) || other.isAnswerSubmitted == isAnswerSubmitted)&&(identical(other.isCorrect, isCorrect) || other.isCorrect == isCorrect)&&(identical(other.answerFeedbackDelay, answerFeedbackDelay) || other.answerFeedbackDelay == answerFeedbackDelay)); +} + + +@override +int get hashCode => Object.hash(runtimeType,test,const DeepCollectionEquality().hash(_questions),currentQuestionIndex,currentResult,const DeepCollectionEquality().hash(_questionResults),isAnswerSubmitted,isCorrect,answerFeedbackDelay); + +@override +String toString() { + return 'TestsState.gameSessionActive(test: $test, questions: $questions, currentQuestionIndex: $currentQuestionIndex, currentResult: $currentResult, questionResults: $questionResults, isAnswerSubmitted: $isAnswerSubmitted, isCorrect: $isCorrect, answerFeedbackDelay: $answerFeedbackDelay)'; } -abstract class _GameSessionPreparing implements TestsState { - const factory _GameSessionPreparing( - {required final TestDto test, - required final List questions}) = - _$GameSessionPreparingImpl; - TestDto get test; - List get questions; - @JsonKey(ignore: true) - _$$GameSessionPreparingImplCopyWith<_$GameSessionPreparingImpl> - get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$GameSessionActiveImplCopyWith<$Res> { - factory _$$GameSessionActiveImplCopyWith(_$GameSessionActiveImpl value, - $Res Function(_$GameSessionActiveImpl) then) = - __$$GameSessionActiveImplCopyWithImpl<$Res>; - @useResult - $Res call( - {TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay}); +abstract mixin class _$GameSessionActiveCopyWith<$Res> implements $TestsStateCopyWith<$Res> { + factory _$GameSessionActiveCopyWith(_GameSessionActive value, $Res Function(_GameSessionActive) _then) = __$GameSessionActiveCopyWithImpl; +@useResult +$Res call({ + TestDto test, List questions, int currentQuestionIndex, GameSessionResult? currentResult, Map questionResults, bool isAnswerSubmitted, bool isCorrect, Duration? answerFeedbackDelay +}); - $GameSessionResultCopyWith<$Res>? get currentResult; + +$GameSessionResultCopyWith<$Res>? get currentResult; + +} +/// @nodoc +class __$GameSessionActiveCopyWithImpl<$Res> + implements _$GameSessionActiveCopyWith<$Res> { + __$GameSessionActiveCopyWithImpl(this._self, this._then); + + final _GameSessionActive _self; + final $Res Function(_GameSessionActive) _then; + +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? test = null,Object? questions = null,Object? currentQuestionIndex = null,Object? currentResult = freezed,Object? questionResults = null,Object? isAnswerSubmitted = null,Object? isCorrect = null,Object? answerFeedbackDelay = freezed,}) { + return _then(_GameSessionActive( +test: null == test ? _self.test : test // ignore: cast_nullable_to_non_nullable +as TestDto,questions: null == questions ? _self._questions : questions // ignore: cast_nullable_to_non_nullable +as List,currentQuestionIndex: null == currentQuestionIndex ? _self.currentQuestionIndex : currentQuestionIndex // ignore: cast_nullable_to_non_nullable +as int,currentResult: freezed == currentResult ? _self.currentResult : currentResult // ignore: cast_nullable_to_non_nullable +as GameSessionResult?,questionResults: null == questionResults ? _self._questionResults : questionResults // ignore: cast_nullable_to_non_nullable +as Map,isAnswerSubmitted: null == isAnswerSubmitted ? _self.isAnswerSubmitted : isAnswerSubmitted // ignore: cast_nullable_to_non_nullable +as bool,isCorrect: null == isCorrect ? _self.isCorrect : isCorrect // ignore: cast_nullable_to_non_nullable +as bool,answerFeedbackDelay: freezed == answerFeedbackDelay ? _self.answerFeedbackDelay : answerFeedbackDelay // ignore: cast_nullable_to_non_nullable +as Duration?, + )); } -/// @nodoc -class __$$GameSessionActiveImplCopyWithImpl<$Res> - extends _$TestsStateCopyWithImpl<$Res, _$GameSessionActiveImpl> - implements _$$GameSessionActiveImplCopyWith<$Res> { - __$$GameSessionActiveImplCopyWithImpl(_$GameSessionActiveImpl _value, - $Res Function(_$GameSessionActiveImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? test = null, - Object? questions = null, - Object? currentQuestionIndex = null, - Object? currentResult = freezed, - Object? questionResults = null, - Object? isAnswerSubmitted = null, - Object? isCorrect = null, - Object? answerFeedbackDelay = freezed, - }) { - return _then(_$GameSessionActiveImpl( - test: null == test - ? _value.test - : test // ignore: cast_nullable_to_non_nullable - as TestDto, - questions: null == questions - ? _value._questions - : questions // ignore: cast_nullable_to_non_nullable - as List, - currentQuestionIndex: null == currentQuestionIndex - ? _value.currentQuestionIndex - : currentQuestionIndex // ignore: cast_nullable_to_non_nullable - as int, - currentResult: freezed == currentResult - ? _value.currentResult - : currentResult // ignore: cast_nullable_to_non_nullable - as GameSessionResult?, - questionResults: null == questionResults - ? _value._questionResults - : questionResults // ignore: cast_nullable_to_non_nullable - as Map, - isAnswerSubmitted: null == isAnswerSubmitted - ? _value.isAnswerSubmitted - : isAnswerSubmitted // ignore: cast_nullable_to_non_nullable - as bool, - isCorrect: null == isCorrect - ? _value.isCorrect - : isCorrect // ignore: cast_nullable_to_non_nullable - as bool, - answerFeedbackDelay: freezed == answerFeedbackDelay - ? _value.answerFeedbackDelay - : answerFeedbackDelay // ignore: cast_nullable_to_non_nullable - as Duration?, - )); +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GameSessionResultCopyWith<$Res>? get currentResult { + if (_self.currentResult == null) { + return null; } - @override - @pragma('vm:prefer-inline') - $GameSessionResultCopyWith<$Res>? get currentResult { - if (_value.currentResult == null) { - return null; - } - - return $GameSessionResultCopyWith<$Res>(_value.currentResult!, (value) { - return _then(_value.copyWith(currentResult: value)); - }); - } + return $GameSessionResultCopyWith<$Res>(_self.currentResult!, (value) { + return _then(_self.copyWith(currentResult: value)); + }); +} } /// @nodoc -class _$GameSessionActiveImpl implements _GameSessionActive { - const _$GameSessionActiveImpl( - {required this.test, - required final List questions, - required this.currentQuestionIndex, - required this.currentResult, - required final Map questionResults, - required this.isAnswerSubmitted, - required this.isCorrect, - this.answerFeedbackDelay}) - : _questions = questions, - _questionResults = questionResults; - @override - final TestDto test; - final List _questions; - @override - List get questions { - if (_questions is EqualUnmodifiableListView) return _questions; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_questions); - } +class _GameSessionCompleted implements TestsState { + const _GameSessionCompleted({required this.test, required this.result}); + - @override - final int currentQuestionIndex; - @override - final GameSessionResult? currentResult; - final Map _questionResults; - @override - Map get questionResults { - if (_questionResults is EqualUnmodifiableMapView) return _questionResults; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_questionResults); - } + final TestDto test; + final GameSessionResult result; - @override - final bool isAnswerSubmitted; - @override - final bool isCorrect; - @override - final Duration? answerFeedbackDelay; +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$GameSessionCompletedCopyWith<_GameSessionCompleted> get copyWith => __$GameSessionCompletedCopyWithImpl<_GameSessionCompleted>(this, _$identity); - @override - String toString() { - return 'TestsState.gameSessionActive(test: $test, questions: $questions, currentQuestionIndex: $currentQuestionIndex, currentResult: $currentResult, questionResults: $questionResults, isAnswerSubmitted: $isAnswerSubmitted, isCorrect: $isCorrect, answerFeedbackDelay: $answerFeedbackDelay)'; - } - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$GameSessionActiveImpl && - (identical(other.test, test) || other.test == test) && - const DeepCollectionEquality() - .equals(other._questions, _questions) && - (identical(other.currentQuestionIndex, currentQuestionIndex) || - other.currentQuestionIndex == currentQuestionIndex) && - (identical(other.currentResult, currentResult) || - other.currentResult == currentResult) && - const DeepCollectionEquality() - .equals(other._questionResults, _questionResults) && - (identical(other.isAnswerSubmitted, isAnswerSubmitted) || - other.isAnswerSubmitted == isAnswerSubmitted) && - (identical(other.isCorrect, isCorrect) || - other.isCorrect == isCorrect) && - (identical(other.answerFeedbackDelay, answerFeedbackDelay) || - other.answerFeedbackDelay == answerFeedbackDelay)); - } - @override - int get hashCode => Object.hash( - runtimeType, - test, - const DeepCollectionEquality().hash(_questions), - currentQuestionIndex, - currentResult, - const DeepCollectionEquality().hash(_questionResults), - isAnswerSubmitted, - isCorrect, - answerFeedbackDelay); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$GameSessionActiveImplCopyWith<_$GameSessionActiveImpl> get copyWith => - __$$GameSessionActiveImplCopyWithImpl<_$GameSessionActiveImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function(List tests, String packId) loaded, - required TResult Function(String message) error, - required TResult Function(TestDto test, List questions) - gameSessionPreparing, - required TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay) - gameSessionActive, - required TResult Function(TestDto test, GameSessionResult result) - gameSessionCompleted, - }) { - return gameSessionActive( - test, - questions, - currentQuestionIndex, - currentResult, - questionResults, - isAnswerSubmitted, - isCorrect, - answerFeedbackDelay); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List tests, String packId)? loaded, - TResult? Function(String message)? error, - TResult? Function(TestDto test, List questions)? - gameSessionPreparing, - TResult? Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult? Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - }) { - return gameSessionActive?.call( - test, - questions, - currentQuestionIndex, - currentResult, - questionResults, - isAnswerSubmitted, - isCorrect, - answerFeedbackDelay); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List tests, String packId)? loaded, - TResult Function(String message)? error, - TResult Function(TestDto test, List questions)? - gameSessionPreparing, - TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - required TResult orElse(), - }) { - if (gameSessionActive != null) { - return gameSessionActive( - test, - questions, - currentQuestionIndex, - currentResult, - questionResults, - isAnswerSubmitted, - isCorrect, - answerFeedbackDelay); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_GameSessionPreparing value) gameSessionPreparing, - required TResult Function(_GameSessionActive value) gameSessionActive, - required TResult Function(_GameSessionCompleted value) gameSessionCompleted, - }) { - return gameSessionActive(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult? Function(_GameSessionActive value)? gameSessionActive, - TResult? Function(_GameSessionCompleted value)? gameSessionCompleted, - }) { - return gameSessionActive?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult Function(_GameSessionActive value)? gameSessionActive, - TResult Function(_GameSessionCompleted value)? gameSessionCompleted, - required TResult orElse(), - }) { - if (gameSessionActive != null) { - return gameSessionActive(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _GameSessionCompleted&&(identical(other.test, test) || other.test == test)&&(identical(other.result, result) || other.result == result)); +} + + +@override +int get hashCode => Object.hash(runtimeType,test,result); + +@override +String toString() { + return 'TestsState.gameSessionCompleted(test: $test, result: $result)'; } -abstract class _GameSessionActive implements TestsState { - const factory _GameSessionActive( - {required final TestDto test, - required final List questions, - required final int currentQuestionIndex, - required final GameSessionResult? currentResult, - required final Map questionResults, - required final bool isAnswerSubmitted, - required final bool isCorrect, - final Duration? answerFeedbackDelay}) = _$GameSessionActiveImpl; - TestDto get test; - List get questions; - int get currentQuestionIndex; - GameSessionResult? get currentResult; - Map get questionResults; - bool get isAnswerSubmitted; - bool get isCorrect; - Duration? get answerFeedbackDelay; - @JsonKey(ignore: true) - _$$GameSessionActiveImplCopyWith<_$GameSessionActiveImpl> get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$GameSessionCompletedImplCopyWith<$Res> { - factory _$$GameSessionCompletedImplCopyWith(_$GameSessionCompletedImpl value, - $Res Function(_$GameSessionCompletedImpl) then) = - __$$GameSessionCompletedImplCopyWithImpl<$Res>; - @useResult - $Res call({TestDto test, GameSessionResult result}); +abstract mixin class _$GameSessionCompletedCopyWith<$Res> implements $TestsStateCopyWith<$Res> { + factory _$GameSessionCompletedCopyWith(_GameSessionCompleted value, $Res Function(_GameSessionCompleted) _then) = __$GameSessionCompletedCopyWithImpl; +@useResult +$Res call({ + TestDto test, GameSessionResult result +}); + + +$GameSessionResultCopyWith<$Res> get result; - $GameSessionResultCopyWith<$Res> get result; } - /// @nodoc -class __$$GameSessionCompletedImplCopyWithImpl<$Res> - extends _$TestsStateCopyWithImpl<$Res, _$GameSessionCompletedImpl> - implements _$$GameSessionCompletedImplCopyWith<$Res> { - __$$GameSessionCompletedImplCopyWithImpl(_$GameSessionCompletedImpl _value, - $Res Function(_$GameSessionCompletedImpl) _then) - : super(_value, _then); +class __$GameSessionCompletedCopyWithImpl<$Res> + implements _$GameSessionCompletedCopyWith<$Res> { + __$GameSessionCompletedCopyWithImpl(this._self, this._then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? test = null, - Object? result = null, - }) { - return _then(_$GameSessionCompletedImpl( - test: null == test - ? _value.test - : test // ignore: cast_nullable_to_non_nullable - as TestDto, - result: null == result - ? _value.result - : result // ignore: cast_nullable_to_non_nullable - as GameSessionResult, - )); - } + final _GameSessionCompleted _self; + final $Res Function(_GameSessionCompleted) _then; - @override - @pragma('vm:prefer-inline') - $GameSessionResultCopyWith<$Res> get result { - return $GameSessionResultCopyWith<$Res>(_value.result, (value) { - return _then(_value.copyWith(result: value)); - }); - } +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? test = null,Object? result = null,}) { + return _then(_GameSessionCompleted( +test: null == test ? _self.test : test // ignore: cast_nullable_to_non_nullable +as TestDto,result: null == result ? _self.result : result // ignore: cast_nullable_to_non_nullable +as GameSessionResult, + )); } -/// @nodoc - -class _$GameSessionCompletedImpl implements _GameSessionCompleted { - const _$GameSessionCompletedImpl({required this.test, required this.result}); - - @override - final TestDto test; - @override - final GameSessionResult result; - - @override - String toString() { - return 'TestsState.gameSessionCompleted(test: $test, result: $result)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$GameSessionCompletedImpl && - (identical(other.test, test) || other.test == test) && - (identical(other.result, result) || other.result == result)); - } - - @override - int get hashCode => Object.hash(runtimeType, test, result); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$GameSessionCompletedImplCopyWith<_$GameSessionCompletedImpl> - get copyWith => - __$$GameSessionCompletedImplCopyWithImpl<_$GameSessionCompletedImpl>( - this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() loading, - required TResult Function(List tests, String packId) loaded, - required TResult Function(String message) error, - required TResult Function(TestDto test, List questions) - gameSessionPreparing, - required TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay) - gameSessionActive, - required TResult Function(TestDto test, GameSessionResult result) - gameSessionCompleted, - }) { - return gameSessionCompleted(test, result); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? loading, - TResult? Function(List tests, String packId)? loaded, - TResult? Function(String message)? error, - TResult? Function(TestDto test, List questions)? - gameSessionPreparing, - TResult? Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult? Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - }) { - return gameSessionCompleted?.call(test, result); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? loading, - TResult Function(List tests, String packId)? loaded, - TResult Function(String message)? error, - TResult Function(TestDto test, List questions)? - gameSessionPreparing, - TResult Function( - TestDto test, - List questions, - int currentQuestionIndex, - GameSessionResult? currentResult, - Map questionResults, - bool isAnswerSubmitted, - bool isCorrect, - Duration? answerFeedbackDelay)? - gameSessionActive, - TResult Function(TestDto test, GameSessionResult result)? - gameSessionCompleted, - required TResult orElse(), - }) { - if (gameSessionCompleted != null) { - return gameSessionCompleted(test, result); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Loading value) loading, - required TResult Function(_Loaded value) loaded, - required TResult Function(_Error value) error, - required TResult Function(_GameSessionPreparing value) gameSessionPreparing, - required TResult Function(_GameSessionActive value) gameSessionActive, - required TResult Function(_GameSessionCompleted value) gameSessionCompleted, - }) { - return gameSessionCompleted(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Loading value)? loading, - TResult? Function(_Loaded value)? loaded, - TResult? Function(_Error value)? error, - TResult? Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult? Function(_GameSessionActive value)? gameSessionActive, - TResult? Function(_GameSessionCompleted value)? gameSessionCompleted, - }) { - return gameSessionCompleted?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Loading value)? loading, - TResult Function(_Loaded value)? loaded, - TResult Function(_Error value)? error, - TResult Function(_GameSessionPreparing value)? gameSessionPreparing, - TResult Function(_GameSessionActive value)? gameSessionActive, - TResult Function(_GameSessionCompleted value)? gameSessionCompleted, - required TResult orElse(), - }) { - if (gameSessionCompleted != null) { - return gameSessionCompleted(this); - } - return orElse(); - } +/// Create a copy of TestsState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$GameSessionResultCopyWith<$Res> get result { + + return $GameSessionResultCopyWith<$Res>(_self.result, (value) { + return _then(_self.copyWith(result: value)); + }); +} } -abstract class _GameSessionCompleted implements TestsState { - const factory _GameSessionCompleted( - {required final TestDto test, - required final GameSessionResult result}) = _$GameSessionCompletedImpl; - - TestDto get test; - GameSessionResult get result; - @JsonKey(ignore: true) - _$$GameSessionCompletedImplCopyWith<_$GameSessionCompletedImpl> - get copyWith => throw _privateConstructorUsedError; -} +// dart format on diff --git a/mnemo_cards_web_v2/lib/domain/state/user_state_manager.freezed.dart b/mnemo_cards_web_v2/lib/domain/state/user_state_manager.freezed.dart index 64c01ef..0c17f86 100644 --- a/mnemo_cards_web_v2/lib/domain/state/user_state_manager.freezed.dart +++ b/mnemo_cards_web_v2/lib/domain/state/user_state_manager.freezed.dart @@ -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,428 +9,308 @@ part of 'user_state_manager.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - /// @nodoc mixin _$UserState { - @optionalTypeArgs - TResult when({ - required TResult Function() guest, - required TResult Function(UserDto user) authenticated, - required TResult Function() loading, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? guest, - TResult? Function(UserDto user)? authenticated, - TResult? Function()? loading, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? guest, - TResult Function(UserDto user)? authenticated, - TResult Function()? loading, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(_Guest value) guest, - required TResult Function(_Authenticated value) authenticated, - required TResult Function(_Loading value) loading, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Guest value)? guest, - TResult? Function(_Authenticated value)? authenticated, - TResult? Function(_Loading value)? loading, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Guest value)? guest, - TResult Function(_Authenticated value)? authenticated, - TResult Function(_Loading value)? loading, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; + + + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UserState); +} + + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'UserState()'; +} + + } /// @nodoc -abstract class $UserStateCopyWith<$Res> { - factory $UserStateCopyWith(UserState value, $Res Function(UserState) then) = - _$UserStateCopyWithImpl<$Res, UserState>; +class $UserStateCopyWith<$Res> { +$UserStateCopyWith(UserState _, $Res Function(UserState) __); } -/// @nodoc -class _$UserStateCopyWithImpl<$Res, $Val extends UserState> - implements $UserStateCopyWith<$Res> { - _$UserStateCopyWithImpl(this._value, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; +/// Adds pattern-matching-related methods to [UserState]. +extension UserStatePatterns on UserState { +/// 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 Function( _Guest value)? guest,TResult Function( _Authenticated value)? authenticated,TResult Function( _Loading value)? loading,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Guest() when guest != null: +return guest(_that);case _Authenticated() when authenticated != null: +return authenticated(_that);case _Loading() when loading != null: +return loading(_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({required TResult Function( _Guest value) guest,required TResult Function( _Authenticated value) authenticated,required TResult Function( _Loading value) loading,}){ +final _that = this; +switch (_that) { +case _Guest(): +return guest(_that);case _Authenticated(): +return authenticated(_that);case _Loading(): +return loading(_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? Function( _Guest value)? guest,TResult? Function( _Authenticated value)? authenticated,TResult? Function( _Loading value)? loading,}){ +final _that = this; +switch (_that) { +case _Guest() when guest != null: +return guest(_that);case _Authenticated() when authenticated != null: +return authenticated(_that);case _Loading() when loading != null: +return loading(_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 Function()? guest,TResult Function( UserDto user)? authenticated,TResult Function()? loading,required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Guest() when guest != null: +return guest();case _Authenticated() when authenticated != null: +return authenticated(_that.user);case _Loading() when loading != null: +return loading();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({required TResult Function() guest,required TResult Function( UserDto user) authenticated,required TResult Function() loading,}) {final _that = this; +switch (_that) { +case _Guest(): +return guest();case _Authenticated(): +return authenticated(_that.user);case _Loading(): +return loading();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? Function()? guest,TResult? Function( UserDto user)? authenticated,TResult? Function()? loading,}) {final _that = this; +switch (_that) { +case _Guest() when guest != null: +return guest();case _Authenticated() when authenticated != null: +return authenticated(_that.user);case _Loading() when loading != null: +return loading();case _: + return null; + +} } -/// @nodoc -abstract class _$$GuestImplCopyWith<$Res> { - factory _$$GuestImplCopyWith( - _$GuestImpl value, $Res Function(_$GuestImpl) then) = - __$$GuestImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$GuestImplCopyWithImpl<$Res> - extends _$UserStateCopyWithImpl<$Res, _$GuestImpl> - implements _$$GuestImplCopyWith<$Res> { - __$$GuestImplCopyWithImpl( - _$GuestImpl _value, $Res Function(_$GuestImpl) _then) - : super(_value, _then); } /// @nodoc -class _$GuestImpl implements _Guest { - const _$GuestImpl(); - @override - String toString() { - return 'UserState.guest()'; - } +class _Guest implements UserState { + const _Guest(); + - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$GuestImpl); - } - @override - int get hashCode => runtimeType.hashCode; - @override - @optionalTypeArgs - TResult when({ - required TResult Function() guest, - required TResult Function(UserDto user) authenticated, - required TResult Function() loading, - }) { - return guest(); - } - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? guest, - TResult? Function(UserDto user)? authenticated, - TResult? Function()? loading, - }) { - return guest?.call(); - } - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? guest, - TResult Function(UserDto user)? authenticated, - TResult Function()? loading, - required TResult orElse(), - }) { - if (guest != null) { - return guest(); - } - return orElse(); - } - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Guest value) guest, - required TResult Function(_Authenticated value) authenticated, - required TResult Function(_Loading value) loading, - }) { - return guest(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Guest value)? guest, - TResult? Function(_Authenticated value)? authenticated, - TResult? Function(_Loading value)? loading, - }) { - return guest?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Guest value)? guest, - TResult Function(_Authenticated value)? authenticated, - TResult Function(_Loading value)? loading, - required TResult orElse(), - }) { - if (guest != null) { - return guest(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Guest); } -abstract class _Guest implements UserState { - const factory _Guest() = _$GuestImpl; + +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'UserState.guest()'; +} + + +} + + + + +/// @nodoc + + +class _Authenticated implements UserState { + const _Authenticated({required this.user}); + + + final UserDto user; + +/// Create a copy of UserState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$AuthenticatedCopyWith<_Authenticated> get copyWith => __$AuthenticatedCopyWithImpl<_Authenticated>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Authenticated&&(identical(other.user, user) || other.user == user)); +} + + +@override +int get hashCode => Object.hash(runtimeType,user); + +@override +String toString() { + return 'UserState.authenticated(user: $user)'; +} + + } /// @nodoc -abstract class _$$AuthenticatedImplCopyWith<$Res> { - factory _$$AuthenticatedImplCopyWith( - _$AuthenticatedImpl value, $Res Function(_$AuthenticatedImpl) then) = - __$$AuthenticatedImplCopyWithImpl<$Res>; - @useResult - $Res call({UserDto user}); +abstract mixin class _$AuthenticatedCopyWith<$Res> implements $UserStateCopyWith<$Res> { + factory _$AuthenticatedCopyWith(_Authenticated value, $Res Function(_Authenticated) _then) = __$AuthenticatedCopyWithImpl; +@useResult +$Res call({ + UserDto user +}); + + + + +} +/// @nodoc +class __$AuthenticatedCopyWithImpl<$Res> + implements _$AuthenticatedCopyWith<$Res> { + __$AuthenticatedCopyWithImpl(this._self, this._then); + + final _Authenticated _self; + final $Res Function(_Authenticated) _then; + +/// Create a copy of UserState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? user = null,}) { + return _then(_Authenticated( +user: null == user ? _self.user : user // ignore: cast_nullable_to_non_nullable +as UserDto, + )); } -/// @nodoc -class __$$AuthenticatedImplCopyWithImpl<$Res> - extends _$UserStateCopyWithImpl<$Res, _$AuthenticatedImpl> - implements _$$AuthenticatedImplCopyWith<$Res> { - __$$AuthenticatedImplCopyWithImpl( - _$AuthenticatedImpl _value, $Res Function(_$AuthenticatedImpl) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? user = null, - }) { - return _then(_$AuthenticatedImpl( - user: null == user - ? _value.user - : user // ignore: cast_nullable_to_non_nullable - as UserDto, - )); - } } /// @nodoc -class _$AuthenticatedImpl implements _Authenticated { - const _$AuthenticatedImpl({required this.user}); - @override - final UserDto user; +class _Loading implements UserState { + const _Loading(); + - @override - String toString() { - return 'UserState.authenticated(user: $user)'; - } - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$AuthenticatedImpl && - (identical(other.user, user) || other.user == user)); - } - @override - int get hashCode => Object.hash(runtimeType, user); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$AuthenticatedImplCopyWith<_$AuthenticatedImpl> get copyWith => - __$$AuthenticatedImplCopyWithImpl<_$AuthenticatedImpl>(this, _$identity); - @override - @optionalTypeArgs - TResult when({ - required TResult Function() guest, - required TResult Function(UserDto user) authenticated, - required TResult Function() loading, - }) { - return authenticated(user); - } - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? guest, - TResult? Function(UserDto user)? authenticated, - TResult? Function()? loading, - }) { - return authenticated?.call(user); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? guest, - TResult Function(UserDto user)? authenticated, - TResult Function()? loading, - required TResult orElse(), - }) { - if (authenticated != null) { - return authenticated(user); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Guest value) guest, - required TResult Function(_Authenticated value) authenticated, - required TResult Function(_Loading value) loading, - }) { - return authenticated(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Guest value)? guest, - TResult? Function(_Authenticated value)? authenticated, - TResult? Function(_Loading value)? loading, - }) { - return authenticated?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Guest value)? guest, - TResult Function(_Authenticated value)? authenticated, - TResult Function(_Loading value)? loading, - required TResult orElse(), - }) { - if (authenticated != null) { - return authenticated(this); - } - return orElse(); - } +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loading); } -abstract class _Authenticated implements UserState { - const factory _Authenticated({required final UserDto user}) = - _$AuthenticatedImpl; - UserDto get user; - @JsonKey(ignore: true) - _$$AuthenticatedImplCopyWith<_$AuthenticatedImpl> get copyWith => - throw _privateConstructorUsedError; +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'UserState.loading()'; } -/// @nodoc -abstract class _$$LoadingImplCopyWith<$Res> { - factory _$$LoadingImplCopyWith( - _$LoadingImpl value, $Res Function(_$LoadingImpl) then) = - __$$LoadingImplCopyWithImpl<$Res>; + } -/// @nodoc -class __$$LoadingImplCopyWithImpl<$Res> - extends _$UserStateCopyWithImpl<$Res, _$LoadingImpl> - implements _$$LoadingImplCopyWith<$Res> { - __$$LoadingImplCopyWithImpl( - _$LoadingImpl _value, $Res Function(_$LoadingImpl) _then) - : super(_value, _then); -} -/// @nodoc -class _$LoadingImpl implements _Loading { - const _$LoadingImpl(); - @override - String toString() { - return 'UserState.loading()'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$LoadingImpl); - } - - @override - int get hashCode => runtimeType.hashCode; - - @override - @optionalTypeArgs - TResult when({ - required TResult Function() guest, - required TResult Function(UserDto user) authenticated, - required TResult Function() loading, - }) { - return loading(); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function()? guest, - TResult? Function(UserDto user)? authenticated, - TResult? Function()? loading, - }) { - return loading?.call(); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function()? guest, - TResult Function(UserDto user)? authenticated, - TResult Function()? loading, - required TResult orElse(), - }) { - if (loading != null) { - return loading(); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(_Guest value) guest, - required TResult Function(_Authenticated value) authenticated, - required TResult Function(_Loading value) loading, - }) { - return loading(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(_Guest value)? guest, - TResult? Function(_Authenticated value)? authenticated, - TResult? Function(_Loading value)? loading, - }) { - return loading?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(_Guest value)? guest, - TResult Function(_Authenticated value)? authenticated, - TResult Function(_Loading value)? loading, - required TResult orElse(), - }) { - if (loading != null) { - return loading(this); - } - return orElse(); - } -} - -abstract class _Loading implements UserState { - const factory _Loading() = _$LoadingImpl; -} +// dart format on diff --git a/mnemo_cards_web_v2/lib/presentation/pages/games/games_page.dart b/mnemo_cards_web_v2/lib/presentation/pages/games/games_page.dart index 88cc544..1601e25 100644 --- a/mnemo_cards_web_v2/lib/presentation/pages/games/games_page.dart +++ b/mnemo_cards_web_v2/lib/presentation/pages/games/games_page.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:mnemo_cards_web_v2/domain/state/games_state_manager.dart'; import 'package:yx_scope_flutter/yx_scope_flutter.dart'; import 'package:yx_state_flutter/yx_state_flutter.dart'; diff --git a/mnemo_cards_web_v2/lib/presentation/pages/home/home_page.dart b/mnemo_cards_web_v2/lib/presentation/pages/home/home_page.dart index fab2807..b407f2b 100644 --- a/mnemo_cards_web_v2/lib/presentation/pages/home/home_page.dart +++ b/mnemo_cards_web_v2/lib/presentation/pages/home/home_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:mnemo_cards_common/mnemo_cards_common.dart'; +import 'package:mnemo_cards_web_v2/domain/state/packs_state_manager.dart'; import 'package:yx_scope_flutter/yx_scope_flutter.dart'; import 'package:yx_state_flutter/yx_state_flutter.dart'; diff --git a/mnemo_cards_web_v2/lib/presentation/pages/pack_details/pack_details_page.dart b/mnemo_cards_web_v2/lib/presentation/pages/pack_details/pack_details_page.dart index 068dd33..089deb4 100644 --- a/mnemo_cards_web_v2/lib/presentation/pages/pack_details/pack_details_page.dart +++ b/mnemo_cards_web_v2/lib/presentation/pages/pack_details/pack_details_page.dart @@ -48,7 +48,7 @@ class _PackDetailsPageState extends State { List _shuffledCards = []; int _shuffleAnimationKey = 0; double _shuffleAnimationTurns = 0; - Map _previousCardIndexById = {}; + Map _previousCardIndexById = {}; int _lastAnimatedShuffleKey = 0; bool _isNavigatingToPurchase = false; @@ -539,9 +539,9 @@ class _PackDetailsPageState extends State { final shouldAnimateMovement = _lastAnimatedShuffleKey != _shuffleAnimationKey; final previousIndexById = shouldAnimateMovement - ? Map.from(_previousCardIndexById) - : const {}; - final currentIndexById = { + ? Map.from(_previousCardIndexById) + : const {}; + final currentIndexById = { for (var i = 0; i < displayCards.length; i++) displayCards[i].id: i, }; @@ -587,7 +587,7 @@ class _PackDetailsPageState extends State { List cards, Color packColor, bool animateMovement, - Map previousIndexById, + Map previousIndexById, ) { const spacing = 8.0; const childAspectRatio = 0.8; @@ -644,7 +644,7 @@ class _PackDetailsPageState extends State { List cards, Color packColor, bool animateMovement, - Map previousIndexById, + Map previousIndexById, ) { const itemHeight = 100.0; const spacing = 8.0; @@ -943,7 +943,7 @@ class _PackDetailsPageState extends State { } /// Marks a card as learned - Future _markCardLearned(int cardId) async { + Future _markCardLearned(String cardId) async { try { final appScope = ScopeProvider.of( context, @@ -1024,7 +1024,7 @@ class _PackDetailsPageState extends State { } /// Проверяет, является ли карточка избранной - bool _isCardFavorite(int cardId) { + bool _isCardFavorite(String cardId) { final appScope = ScopeProvider.of( context, listen: false, @@ -1036,7 +1036,7 @@ class _PackDetailsPageState extends State { } /// Переключает статус избранного для карточки - Future _toggleCardFavorite(int cardId) async { + Future _toggleCardFavorite(String cardId) async { final appScope = ScopeProvider.of( context, listen: false, diff --git a/mnemo_cards_web_v2/lib/presentation/pages/profile/profile_page.dart b/mnemo_cards_web_v2/lib/presentation/pages/profile/profile_page.dart index 10d3ae7..d9c6cdc 100644 --- a/mnemo_cards_web_v2/lib/presentation/pages/profile/profile_page.dart +++ b/mnemo_cards_web_v2/lib/presentation/pages/profile/profile_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:mnemo_cards_common/mnemo_cards_common.dart'; import 'package:mnemo_cards_web_v2/di/user_scope/user_scope.dart'; +import 'package:mnemo_cards_web_v2/domain/state/user_state_manager.dart'; import 'package:yx_scope_flutter/yx_scope_flutter.dart'; import 'package:yx_state_flutter/yx_state_flutter.dart'; diff --git a/mnemo_cards_web_v2/lib/presentation/widgets/card_viewer.dart b/mnemo_cards_web_v2/lib/presentation/widgets/card_viewer.dart index 57e90ef..6ea3c2f 100644 --- a/mnemo_cards_web_v2/lib/presentation/widgets/card_viewer.dart +++ b/mnemo_cards_web_v2/lib/presentation/widgets/card_viewer.dart @@ -40,7 +40,7 @@ class CardViewer extends StatefulWidget { class _CardViewerState extends State { late PageController _pageController; late int _currentIndex; - final Map _flippedCards = {}; + final Map _flippedCards = {}; final FocusNode _focusNode = FocusNode(); @override @@ -62,11 +62,11 @@ class _CardViewerState extends State { super.dispose(); } - bool _isCardFlipped(int index) => _flippedCards[index] ?? false; + bool _isCardFlipped(String cardId) => _flippedCards[cardId] ?? false; - void _toggleCardFlip(int index) { + void _toggleCardFlip(String cardId) { setState(() { - _flippedCards[index] = !_isCardFlipped(index); + _flippedCards[cardId] = !_isCardFlipped(cardId); }); } @@ -283,10 +283,10 @@ class _CardViewerState extends State { } Widget _buildCard(GameCardDto card, int index, Color packColor) { - final isFlipped = _isCardFlipped(index); + final isFlipped = _isCardFlipped(card.id); return GestureDetector( - onTap: () => _toggleCardFlip(index), + onTap: () => _toggleCardFlip(card.id), child: AnimatedSwitcher( duration: const Duration(milliseconds: 300), transitionBuilder: (child, animation) { @@ -583,7 +583,7 @@ class CardVoiceControls extends StatefulWidget { }); final String packId; - final int cardId; + final String cardId; final Color accentColor; @override @@ -594,7 +594,7 @@ class _CardVoiceControlsState extends State { late Future> _voicesFuture; final AudioPlayer _player = AudioPlayer(); bool _isPlaying = false; - int? _currentVoiceId; + String? _currentVoiceId; String? _playError; @override diff --git a/mnemo_cards_web_v2/lib/presentation/widgets/utils/card_movement_utils.dart b/mnemo_cards_web_v2/lib/presentation/widgets/utils/card_movement_utils.dart index 472e7c6..1c0a077 100644 --- a/mnemo_cards_web_v2/lib/presentation/widgets/utils/card_movement_utils.dart +++ b/mnemo_cards_web_v2/lib/presentation/widgets/utils/card_movement_utils.dart @@ -3,8 +3,8 @@ import 'package:flutter/material.dart'; /// Calculates the offset required to animate a card from its previous grid /// position to the new one. Offset resolveGridMovementOffset({ - required Map previousIndexById, - required int cardId, + required Map previousIndexById, + required String cardId, required int currentIndex, required int crossAxisCount, required double itemWidth, @@ -37,8 +37,8 @@ Offset resolveGridMovementOffset({ /// Calculates the offset required to animate a card in list mode. Offset resolveListMovementOffset({ - required Map previousIndexById, - required int cardId, + required Map previousIndexById, + required String cardId, required int currentIndex, required double itemExtent, required double spacing, diff --git a/mnemo_cards_web_v2/pubspec.lock b/mnemo_cards_web_v2/pubspec.lock index d452881..8591c61 100644 --- a/mnemo_cards_web_v2/pubspec.lock +++ b/mnemo_cards_web_v2/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + sha256: c209688d9f5a5f26b2fb47a188131a6fb9e876ae9e47af3737c0b4f58a93470d url: "https://pub.dev" source: hosted - version: "67.0.0" + version: "91.0.0" _flutterfire_internals: dependency: transitive description: @@ -18,13 +18,13 @@ packages: source: hosted version: "1.3.59" analyzer: - dependency: transitive + dependency: "direct overridden" description: name: analyzer - sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + sha256: f51c8499b35f9b26820cfe914828a6a98a94efd5cc78b37bb7d03debae3a1d08 url: "https://pub.dev" source: hosted - version: "6.4.1" + version: "8.4.1" archive: dependency: transitive description: @@ -140,18 +140,18 @@ packages: dependency: transitive description: name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + sha256: c1668065e9ba04752570ad7e038288559d1e2ca5c6d0131c0f5f55e39e777413 url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "4.0.3" build_config: dependency: transitive description: name: build_config - sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33" + sha256: "4f64382b97504dc2fcdf487d5aae33418e08b4703fc21249e4db6d804a4d0187" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.0" build_daemon: dependency: transitive description: @@ -160,30 +160,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.0" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" - url: "https://pub.dev" - source: hosted - version: "2.4.2" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + sha256: "110c56ef29b5eb367b4d17fc79375fa8c18a6cd7acd92c05bb3986c17a079057" url: "https://pub.dev" source: hosted - version: "2.4.13" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 - url: "https://pub.dev" - source: hosted - version: "7.3.2" + version: "2.10.4" built_collection: dependency: transitive description: @@ -300,18 +284,18 @@ packages: dependency: "direct main" description: name: copy_with_extension - sha256: fbcf890b0c34aedf0894f91a11a579994b61b4e04080204656b582708b5b1125 + sha256: bf9f6ca0b88cce32a92e7386ab0dfb179b57d080e4e94254d3f90122e8c354c8 url: "https://pub.dev" source: hosted - version: "5.0.4" + version: "11.0.0" copy_with_extension_gen: dependency: "direct dev" description: name: copy_with_extension_gen - sha256: "51cd11094096d40824c8da629ca7f16f3b7cea5fc44132b679617483d43346b0" + sha256: "4af72c664b7b4cb4c467c084602a1cb87aa0d5ba06d7a06038500e8398810ce1" url: "https://pub.dev" source: hosted - version: "5.0.4" + version: "11.0.0" cross_file: dependency: transitive description: @@ -340,10 +324,10 @@ packages: dependency: transitive description: name: dart_style - sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" + sha256: a9c30492da18ff84efe2422ba2d319a89942d93e58eb0b73d32abe822ef54b7b url: "https://pub.dev" source: hosted - version: "2.3.6" + version: "3.1.3" dbus: dependency: transitive description: @@ -651,26 +635,18 @@ packages: dependency: "direct dev" description: name: freezed - sha256: a434911f643466d78462625df76fd9eb13e57348ff43fe1f77bbe909522c67a1 + sha256: "13065f10e135263a4f5a4391b79a8efc5fb8106f8dd555a9e49b750b45393d77" url: "https://pub.dev" source: hosted - version: "2.5.2" + version: "3.2.3" freezed_annotation: dependency: "direct main" description: name: freezed_annotation - sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 + sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8" url: "https://pub.dev" source: hosted - version: "2.4.4" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 - url: "https://pub.dev" - source: hosted - version: "4.0.0" + version: "3.1.0" game_tests: dependency: "direct main" description: @@ -874,10 +850,10 @@ packages: dependency: "direct dev" description: name: json_serializable - sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b + sha256: "6b253f7851cf1626a05c8b49c792e04a14897349798c03798137f2b5f7e0b5b1" url: "https://pub.dev" source: hosted - version: "6.8.0" + version: "6.11.3" leak_tracker: dependency: transitive description: @@ -1259,18 +1235,18 @@ packages: dependency: transitive description: name: source_gen - sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + sha256: "07b277b67e0096c45196cbddddf2d8c6ffc49342e88bf31d460ce04605ddac75" url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "4.1.1" source_helper: dependency: transitive description: name: source_helper - sha256: "86d247119aedce8e63f4751bd9626fc9613255935558447569ad42f9f5b48b3c" + sha256: e82b1996c63da42aa3e6a34cc1ec17427728a1baf72ed017717a5669a7123f0d url: "https://pub.dev" source: hosted - version: "1.3.5" + version: "1.3.9" source_span: dependency: transitive description: @@ -1391,14 +1367,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.6" - timing: - dependency: transitive - description: - name: timing - sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" - url: "https://pub.dev" - source: hosted - version: "1.0.2" typed_data: dependency: transitive description: diff --git a/mnemo_cards_web_v2/pubspec.yaml b/mnemo_cards_web_v2/pubspec.yaml index 58635d7..882bf85 100644 --- a/mnemo_cards_web_v2/pubspec.yaml +++ b/mnemo_cards_web_v2/pubspec.yaml @@ -49,7 +49,7 @@ dependencies: google_sign_in: ^6.2.1 # Code Generation - freezed_annotation: ^2.4.1 + freezed_annotation: ^3.1.0 json_annotation: ^4.9.0 # Storage @@ -82,7 +82,7 @@ dependencies: path: ../games/packages/game_tests collection: any - copy_with_extension: any + copy_with_extension: ^11.0.0 dev_dependencies: flutter_test: @@ -90,9 +90,9 @@ dev_dependencies: # Code Generation build_runner: ^2.4.13 - freezed: ^2.4.5 + freezed: ^3.2.3 json_serializable: ^6.8.0 - copy_with_extension_gen: ^5.0.4 + copy_with_extension_gen: ^11.0.0 # Linting flutter_lints: ^6.0.0 @@ -100,6 +100,10 @@ dev_dependencies: # yx_scope_linter: ^1.1.0 # TODO: Добавить когда будет доступна версия # custom_lint: ^0.5.3 +dependency_overrides: + freezed_annotation: ^3.1.0 + analyzer: ^8.4.1 + flutter: uses-material-design: true