stugg
Some checks failed
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Web App CI / test (push) Waiting to run
Web App CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
Mobile App CI / test (push) Has been cancelled
Deploy Telegram Bot / Deploy Telegram Bot (push) Has been cancelled
Mobile App CI / build-android (push) Has been cancelled
Mobile App CI / build-ios (push) Has been cancelled

This commit is contained in:
Dmitry 2025-12-14 04:01:44 +03:00
parent 115fa26d46
commit adc2d2e2f9
34 changed files with 5861 additions and 8242 deletions

View file

@ -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

View file

@ -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>()),
);

View file

@ -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<AuthApiV2>().router);
v2Router.mount('/', getIt.get<AdminAuthApiV2>().router);
v2Router.mount('/', getIt.get<AdminAnalyticsApiV2>().router);
v2Router.mount('/', getIt.get<AdminCardsApiV2>().router);
v2Router.mount('/', getIt.get<AdminPacksApiV2>().router);
// v2Router.mount('/', getIt.get<PacksApiV2>().router); // disabled
v2Router.mount('/', getIt.get<TestsApiV2>().router);
// v2Router.mount('/', getIt.get<GamesApiV2>().router); // disabled

View file

@ -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<Response> _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<Response> 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;
final total = packId != null
? cards.length
: await _db.packDao.countCards();
// Parse pagination parameters
final page = int.tryParse(queryParams['page'] ?? '1') ?? 1;
final limit = int.tryParse(queryParams['limit'] ?? '20') ?? 20;
final search = queryParams['search'] ?? '';
// 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<GameCard> 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,
'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/<cardId>')
/// GET /api/v2/admin/cards/{cardId}
/// Get a specific card by ID
@Route.get('/admin/cards/<cardId>')
Future<Response> 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<Response> createCard(Request request) async {
try {
final body = await request.readAsString();
@ -128,7 +190,9 @@ class AdminCardsApiV2 {
}
}
@Route.put('/cards/<cardId>')
/// PUT /api/v2/admin/cards/{cardId}
/// Update a card
@Route.put('/admin/cards/<cardId>')
Future<Response> updateCard(Request request, String cardId) async {
try {
if (cardId.isEmpty) {
@ -173,7 +237,9 @@ class AdminCardsApiV2 {
}
}
@Route.delete('/cards/<cardId>')
/// DELETE /api/v2/admin/cards/{cardId}
/// Delete a card
@Route.delete('/admin/cards/<cardId>')
Future<Response> 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);
}

View file

@ -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/<cardId>', service.getCard);
router.add('POST', r'/cards', service.createCard);
router.add('PUT', r'/cards/<cardId>', service.updateCard);
router.add('DELETE', r'/cards/<cardId>', service.deleteCard);
router.add('GET', r'/admin/cards', service.getAllCards);
router.add('GET', r'/admin/cards/<cardId>', service.getCard);
router.add('POST', r'/admin/cards', service.createCard);
router.add('PUT', r'/admin/cards/<cardId>', service.updateCard);
router.add('DELETE', r'/admin/cards/<cardId>', service.deleteCard);
return router;
}

View file

@ -6,7 +6,7 @@ part 'user_settings_dto.g.dart';
@JsonSerializable()
@CopyWith()
class UserSettingsDto {
final Map<int, PackCardsOrderDto> packCardsOrder;
final Map<String, PackCardsOrderDto> packCardsOrder;
UserSettingsDto({this.packCardsOrder = const {}});
@ -19,10 +19,10 @@ class UserSettingsDto {
@JsonSerializable()
@CopyWith()
class PackCardsOrderDto {
final int packId;
final String packId;
final List<int> cardsOrder;
PackCardsOrderDto({this.packId = -1, this.cardsOrder = const []});
PackCardsOrderDto({this.packId = '', this.cardsOrder = const []});
factory PackCardsOrderDto.fromJson(Map<String, dynamic> json) =>
_$PackCardsOrderDtoFromJson(json);

View file

@ -7,7 +7,7 @@ part of 'user_settings_dto.dart';
// **************************************************************************
abstract class _$UserSettingsDtoCWProxy {
UserSettingsDto packCardsOrder(Map<int, PackCardsOrderDto> packCardsOrder);
UserSettingsDto packCardsOrder(Map<String, PackCardsOrderDto> 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<int, PackCardsOrderDto> packCardsOrder});
UserSettingsDto call({Map<String, PackCardsOrderDto> packCardsOrder});
}
/// Callable proxy for `copyWith` functionality.
@ -27,8 +27,9 @@ class _$UserSettingsDtoCWProxyImpl implements _$UserSettingsDtoCWProxy {
final UserSettingsDto _value;
@override
UserSettingsDto packCardsOrder(Map<int, PackCardsOrderDto> packCardsOrder) =>
call(packCardsOrder: packCardsOrder);
UserSettingsDto packCardsOrder(
Map<String, PackCardsOrderDto> 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<int, PackCardsOrderDto>,
: packCardsOrder as Map<String, PackCardsOrderDto>,
);
}
}
@ -60,7 +61,7 @@ extension $UserSettingsDtoCopyWith on UserSettingsDto {
}
abstract class _$PackCardsOrderDtoCWProxy {
PackCardsOrderDto packId(int packId);
PackCardsOrderDto packId(String packId);
PackCardsOrderDto cardsOrder(List<int> cardsOrder);
@ -71,7 +72,7 @@ abstract class _$PackCardsOrderDtoCWProxy {
/// ```dart
/// PackCardsOrderDto(...).copyWith(id: 12, name: "My name")
/// ```
PackCardsOrderDto call({int packId, List<int> cardsOrder});
PackCardsOrderDto call({String packId, List<int> 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<int> 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<String, dynamic> json) =>
packCardsOrder:
(json['packCardsOrder'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(
int.parse(k),
k,
PackCardsOrderDto.fromJson(e as Map<String, dynamic>),
),
) ??
@ -139,15 +140,11 @@ UserSettingsDto _$UserSettingsDtoFromJson(Map<String, dynamic> json) =>
);
Map<String, dynamic> _$UserSettingsDtoToJson(UserSettingsDto instance) =>
<String, dynamic>{
'packCardsOrder': instance.packCardsOrder.map(
(k, e) => MapEntry(k.toString(), e),
),
};
<String, dynamic>{'packCardsOrder': instance.packCardsOrder};
PackCardsOrderDto _$PackCardsOrderDtoFromJson(Map<String, dynamic> json) =>
PackCardsOrderDto(
packId: (json['packId'] as num?)?.toInt() ?? -1,
packId: json['packId'] as String? ?? '',
cardsOrder:
(json['cardsOrder'] as List<dynamic>?)
?.map((e) => (e as num).toInt())

View file

@ -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

View file

@ -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';
}
}

View file

@ -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)}';
}

View file

@ -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<QuestionResult> questionResults,

File diff suppressed because it is too large Load diff

View file

@ -6,115 +6,110 @@ part of 'game_question.dart';
// JsonSerializableGenerator
// **************************************************************************
_$GameQuestionMultipleChoiceImpl _$$GameQuestionMultipleChoiceImplFromJson(
Map<String, dynamic> json) =>
_$GameQuestionMultipleChoiceImpl(
MultipleChoiceQuestion.fromJson(json['question'] as Map<String, dynamic>),
$type: json['runtimeType'] as String?,
);
GameQuestionMultipleChoice _$GameQuestionMultipleChoiceFromJson(
Map<String, dynamic> json,
) => GameQuestionMultipleChoice(
MultipleChoiceQuestion.fromJson(json['question'] as Map<String, dynamic>),
$type: json['runtimeType'] as String?,
);
Map<String, dynamic> _$$GameQuestionMultipleChoiceImplToJson(
_$GameQuestionMultipleChoiceImpl instance) =>
<String, dynamic>{
'question': instance.question,
'runtimeType': instance.$type,
};
Map<String, dynamic> _$GameQuestionMultipleChoiceToJson(
GameQuestionMultipleChoice instance,
) => <String, dynamic>{
'question': instance.question,
'runtimeType': instance.$type,
};
_$GameQuestionInputLettersImpl _$$GameQuestionInputLettersImplFromJson(
Map<String, dynamic> json) =>
_$GameQuestionInputLettersImpl(
InputLettersQuestion.fromJson(json['question'] as Map<String, dynamic>),
$type: json['runtimeType'] as String?,
);
GameQuestionInputLetters _$GameQuestionInputLettersFromJson(
Map<String, dynamic> json,
) => GameQuestionInputLetters(
InputLettersQuestion.fromJson(json['question'] as Map<String, dynamic>),
$type: json['runtimeType'] as String?,
);
Map<String, dynamic> _$$GameQuestionInputLettersImplToJson(
_$GameQuestionInputLettersImpl instance) =>
<String, dynamic>{
'question': instance.question,
'runtimeType': instance.$type,
};
Map<String, dynamic> _$GameQuestionInputLettersToJson(
GameQuestionInputLetters instance,
) => <String, dynamic>{
'question': instance.question,
'runtimeType': instance.$type,
};
_$GameQuestionMatchImpl _$$GameQuestionMatchImplFromJson(
Map<String, dynamic> json) =>
_$GameQuestionMatchImpl(
GameQuestionMatch _$GameQuestionMatchFromJson(Map<String, dynamic> json) =>
GameQuestionMatch(
MatchQuestion.fromJson(json['question'] as Map<String, dynamic>),
$type: json['runtimeType'] as String?,
);
Map<String, dynamic> _$$GameQuestionMatchImplToJson(
_$GameQuestionMatchImpl instance) =>
Map<String, dynamic> _$GameQuestionMatchToJson(GameQuestionMatch instance) =>
<String, dynamic>{
'question': instance.question,
'runtimeType': instance.$type,
};
_$GameQuestionMatrixImpl _$$GameQuestionMatrixImplFromJson(
Map<String, dynamic> json) =>
_$GameQuestionMatrixImpl(
GameQuestionMatrix _$GameQuestionMatrixFromJson(Map<String, dynamic> json) =>
GameQuestionMatrix(
MatrixQuestion.fromJson(json['question'] as Map<String, dynamic>),
$type: json['runtimeType'] as String?,
);
Map<String, dynamic> _$$GameQuestionMatrixImplToJson(
_$GameQuestionMatrixImpl instance) =>
Map<String, dynamic> _$GameQuestionMatrixToJson(GameQuestionMatrix instance) =>
<String, dynamic>{
'question': instance.question,
'runtimeType': instance.$type,
};
_$MultipleChoiceQuestionImpl _$$MultipleChoiceQuestionImplFromJson(
Map<String, dynamic> 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<dynamic>).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<String, dynamic> 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<dynamic>).map((e) => e as String).toList(),
correctAnswer: json['correctAnswer'] as String,
word: json['word'] as String,
type: json['type'] as String? ?? 'multipleChoice',
);
Map<String, dynamic> _$$MultipleChoiceQuestionImplToJson(
_$MultipleChoiceQuestionImpl instance) =>
<String, dynamic>{
'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<String, dynamic> _$MultipleChoiceQuestionToJson(
_MultipleChoiceQuestion instance,
) => <String, dynamic>{
'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<String, dynamic> 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<String, dynamic> 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<String, dynamic> _$$InputLettersQuestionImplToJson(
_$InputLettersQuestionImpl instance) =>
<String, dynamic>{
'id': instance.id,
'template': instance.template,
'image': instance.image,
'audio': instance.audio,
'correctAnswer': instance.correctAnswer,
'word': instance.word,
'type': instance.type,
};
Map<String, dynamic> _$InputLettersQuestionToJson(
_InputLettersQuestion instance,
) => <String, dynamic>{
'id': instance.id,
'template': instance.template,
'image': instance.image,
'audio': instance.audio,
'correctAnswer': instance.correctAnswer,
'word': instance.word,
'type': instance.type,
};
_$MatchQuestionImpl _$$MatchQuestionImplFromJson(Map<String, dynamic> json) =>
_$MatchQuestionImpl(
_MatchQuestion _$MatchQuestionFromJson(Map<String, dynamic> json) =>
_MatchQuestion(
id: json['id'] as String,
question: json['question'] as String,
image: json['image'] as String?,
@ -132,7 +127,7 @@ _$MatchQuestionImpl _$$MatchQuestionImplFromJson(Map<String, dynamic> json) =>
type: json['type'] as String? ?? 'match',
);
Map<String, dynamic> _$$MatchQuestionImplToJson(_$MatchQuestionImpl instance) =>
Map<String, dynamic> _$MatchQuestionToJson(_MatchQuestion instance) =>
<String, dynamic>{
'id': instance.id,
'question': instance.question,
@ -145,34 +140,29 @@ Map<String, dynamic> _$$MatchQuestionImplToJson(_$MatchQuestionImpl instance) =>
'type': instance.type,
};
_$MatchItemImpl _$$MatchItemImplFromJson(Map<String, dynamic> json) =>
_$MatchItemImpl(
id: json['id'] as String,
text: json['text'] as String,
image: json['image'] as String?,
);
_MatchItem _$MatchItemFromJson(Map<String, dynamic> json) => _MatchItem(
id: json['id'] as String,
text: json['text'] as String,
image: json['image'] as String?,
);
Map<String, dynamic> _$$MatchItemImplToJson(_$MatchItemImpl instance) =>
Map<String, dynamic> _$MatchItemToJson(_MatchItem instance) =>
<String, dynamic>{
'id': instance.id,
'text': instance.text,
'image': instance.image,
};
_$MatchPairImpl _$$MatchPairImplFromJson(Map<String, dynamic> json) =>
_$MatchPairImpl(
leftId: json['leftId'] as String,
rightId: json['rightId'] as String,
);
_MatchPair _$MatchPairFromJson(Map<String, dynamic> json) => _MatchPair(
leftId: json['leftId'] as String,
rightId: json['rightId'] as String,
);
Map<String, dynamic> _$$MatchPairImplToJson(_$MatchPairImpl instance) =>
<String, dynamic>{
'leftId': instance.leftId,
'rightId': instance.rightId,
};
Map<String, dynamic> _$MatchPairToJson(_MatchPair instance) =>
<String, dynamic>{'leftId': instance.leftId, 'rightId': instance.rightId};
_$MatrixQuestionImpl _$$MatrixQuestionImplFromJson(Map<String, dynamic> json) =>
_$MatrixQuestionImpl(
_MatrixQuestion _$MatrixQuestionFromJson(Map<String, dynamic> json) =>
_MatrixQuestion(
id: json['id'] as String,
question: json['question'] as String,
image: json['image'] as String?,
@ -190,8 +180,7 @@ _$MatrixQuestionImpl _$$MatrixQuestionImplFromJson(Map<String, dynamic> json) =>
type: json['type'] as String? ?? 'matrix',
);
Map<String, dynamic> _$$MatrixQuestionImplToJson(
_$MatrixQuestionImpl instance) =>
Map<String, dynamic> _$MatrixQuestionToJson(_MatrixQuestion instance) =>
<String, dynamic>{
'id': instance.id,
'question': instance.question,
@ -204,22 +193,21 @@ Map<String, dynamic> _$$MatrixQuestionImplToJson(
'type': instance.type,
};
_$MatrixCellImpl _$$MatrixCellImplFromJson(Map<String, dynamic> json) =>
_$MatrixCellImpl(
rowIndex: (json['rowIndex'] as num).toInt(),
columnIndex: (json['columnIndex'] as num).toInt(),
value: json['value'] as String,
);
_MatrixCell _$MatrixCellFromJson(Map<String, dynamic> json) => _MatrixCell(
rowIndex: (json['rowIndex'] as num).toInt(),
columnIndex: (json['columnIndex'] as num).toInt(),
value: json['value'] as String,
);
Map<String, dynamic> _$$MatrixCellImplToJson(_$MatrixCellImpl instance) =>
Map<String, dynamic> _$MatrixCellToJson(_MatrixCell instance) =>
<String, dynamic>{
'rowIndex': instance.rowIndex,
'columnIndex': instance.columnIndex,
'value': instance.value,
};
_$QuestionResultImpl _$$QuestionResultImplFromJson(Map<String, dynamic> json) =>
_$QuestionResultImpl(
_QuestionResult _$QuestionResultFromJson(Map<String, dynamic> json) =>
_QuestionResult(
questionId: json['questionId'] as String,
word: json['word'] as String,
isCorrect: json['isCorrect'] as bool,
@ -233,8 +221,7 @@ _$QuestionResultImpl _$$QuestionResultImplFromJson(Map<String, dynamic> json) =>
: DateTime.parse(json['answeredAt'] as String),
);
Map<String, dynamic> _$$QuestionResultImplToJson(
_$QuestionResultImpl instance) =>
Map<String, dynamic> _$QuestionResultToJson(_QuestionResult instance) =>
<String, dynamic>{
'questionId': instance.questionId,
'word': instance.word,
@ -245,9 +232,8 @@ Map<String, dynamic> _$$QuestionResultImplToJson(
'answeredAt': instance.answeredAt?.toIso8601String(),
};
_$GameSessionResultImpl _$$GameSessionResultImplFromJson(
Map<String, dynamic> json) =>
_$GameSessionResultImpl(
_GameSessionResult _$GameSessionResultFromJson(Map<String, dynamic> json) =>
_GameSessionResult(
testId: json['testId'] as String,
questionResults: (json['questionResults'] as List<dynamic>)
.map((e) => QuestionResult.fromJson(e as Map<String, dynamic>))
@ -258,8 +244,7 @@ _$GameSessionResultImpl _$$GameSessionResultImplFromJson(
completedAt: DateTime.parse(json['completedAt'] as String),
);
Map<String, dynamic> _$$GameSessionResultImplToJson(
_$GameSessionResultImpl instance) =>
Map<String, dynamic> _$GameSessionResultToJson(_GameSessionResult instance) =>
<String, dynamic>{
'testId': instance.testId,
'questionResults': instance.questionResults,

View file

@ -9,8 +9,8 @@ class CardFlipperService {
/// Calculate study progress for a pack
StudyProgress calculateStudyProgress({
required List<GameCardDto> cards,
required Map<int, bool> flippedCards,
required Map<int, bool> learnedCards,
required Map<String, bool> flippedCards,
required Map<String, bool> 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;

View file

@ -948,7 +948,7 @@ class HttpRepositoryV2 {
}
/// Get voices metadata for a specific card
Future<List<VoiceDto>> getCardVoices(String packId, int cardId) async {
Future<List<VoiceDto>> getCardVoices(String packId, String cardId) async {
try {
final response = await _dio.get<Map<String, dynamic>>(
ApiConfigV2.packCardVoices(packId, cardId),

View file

@ -63,21 +63,21 @@ class PackProgressService {
}
/// Mark a card as learned in a pack
Future<void> markCardLearned(String packId, int cardId) async {
Future<void> 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<int>().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<int>().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<int> getLearnedCards(String packId) {
Set<String> getLearnedCards(String packId) {
try {
final learnedCardsKey = '${_progressKey}_cards_$packId';
final learnedCardsList = _sharedPreferences.getStringList(learnedCardsKey) ?? [];
return learnedCardsList.map((e) => int.tryParse(e)).whereType<int>().toSet();
return learnedCardsList.toSet();
} catch (e, s) {
log(
'Error getting learned cards',

View file

@ -13,7 +13,7 @@ class CardFlipperState with _$CardFlipperState {
const factory CardFlipperState.loaded({
required List<GameCardDto> cards,
required int currentIndex,
required Map<int, bool> flippedCards,
required Map<String, bool> flippedCards,
required bool isShuffled,
}) = _Loaded;
}
@ -94,7 +94,7 @@ class CardFlipperStateManager extends StateManager<CardFlipperState> {
final isFlipped =
currentState.flippedCards[currentCardId] ?? false;
final updatedFlippedCards =
Map<int, bool>.from(currentState.flippedCards);
Map<String, bool>.from(currentState.flippedCards);
updatedFlippedCards[currentCardId] = !isFlipped;
log(
@ -105,7 +105,7 @@ class CardFlipperStateManager extends StateManager<CardFlipperState> {
});
/// Toggle flip state of specific card
Future<void> toggleCardFlip(int cardId) => handle((emit) async {
Future<void> toggleCardFlip(String cardId) => handle((emit) async {
final currentState = state;
if (currentState is! _Loaded) {
return;
@ -113,7 +113,7 @@ class CardFlipperStateManager extends StateManager<CardFlipperState> {
final isFlipped = currentState.flippedCards[cardId] ?? false;
final updatedFlippedCards =
Map<int, bool>.from(currentState.flippedCards);
Map<String, bool>.from(currentState.flippedCards);
updatedFlippedCards[cardId] = !isFlipped;
log(
@ -185,7 +185,7 @@ class CardFlipperStateManager extends StateManager<CardFlipperState> {
}
/// Check if specific card is flipped
bool isCardFlipped(int cardId) {
bool isCardFlipped(String cardId) {
final currentState = state;
if (currentState is! _Loaded) return false;

View file

@ -1,5 +1,5 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
@ -9,381 +9,288 @@ part of 'card_flipper_state_manager.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$CardFlipperState {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() initial,
required TResult Function(List<GameCardDto> cards, int currentIndex,
Map<int, bool> flippedCards, bool isShuffled)
loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? initial,
TResult? Function(List<GameCardDto> cards, int currentIndex,
Map<int, bool> flippedCards, bool isShuffled)?
loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function(List<GameCardDto> cards, int currentIndex,
Map<int, bool> flippedCards, bool isShuffled)?
loaded,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Initial value) initial,
required TResult Function(_Loaded value) loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Initial value)? initial,
TResult? Function(_Loaded value)? loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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 extends Object?>({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<TResult extends Object?>({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 extends Object?>({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 extends Object?>({TResult Function()? initial,TResult Function( List<GameCardDto> cards, int currentIndex, Map<String, bool> 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<TResult extends Object?>({required TResult Function() initial,required TResult Function( List<GameCardDto> cards, int currentIndex, Map<String, bool> 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 extends Object?>({TResult? Function()? initial,TResult? Function( List<GameCardDto> cards, int currentIndex, Map<String, bool> 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<TResult extends Object?>({
required TResult Function() initial,
required TResult Function(List<GameCardDto> cards, int currentIndex,
Map<int, bool> flippedCards, bool isShuffled)
loaded,
}) {
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? initial,
TResult? Function(List<GameCardDto> cards, int currentIndex,
Map<int, bool> flippedCards, bool isShuffled)?
loaded,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function(List<GameCardDto> cards, int currentIndex,
Map<int, bool> flippedCards, bool isShuffled)?
loaded,
required TResult orElse(),
}) {
if (initial != null) {
return initial();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Initial value) initial,
required TResult Function(_Loaded value) loaded,
}) {
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Initial value)? initial,
TResult? Function(_Loaded value)? loaded,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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<GameCardDto> cards,
int currentIndex,
Map<int, bool> 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<GameCardDto>,
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<int, bool>,
isShuffled: null == isShuffled
? _value.isShuffled
: isShuffled // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
class _$LoadedImpl implements _Loaded {
const _$LoadedImpl(
{required final List<GameCardDto> cards,
required this.currentIndex,
required final Map<int, bool> flippedCards,
required this.isShuffled})
: _cards = cards,
_flippedCards = flippedCards;
final List<GameCardDto> _cards;
@override
List<GameCardDto> get cards {
if (_cards is EqualUnmodifiableListView) return _cards;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_cards);
}
class _Loaded implements CardFlipperState {
const _Loaded({required final List<GameCardDto> cards, required this.currentIndex, required final Map<String, bool> flippedCards, required this.isShuffled}): _cards = cards,_flippedCards = flippedCards;
@override
final int currentIndex;
final Map<int, bool> _flippedCards;
@override
Map<int, bool> 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<TResult extends Object?>({
required TResult Function() initial,
required TResult Function(List<GameCardDto> cards, int currentIndex,
Map<int, bool> flippedCards, bool isShuffled)
loaded,
}) {
return loaded(cards, currentIndex, flippedCards, isShuffled);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? initial,
TResult? Function(List<GameCardDto> cards, int currentIndex,
Map<int, bool> flippedCards, bool isShuffled)?
loaded,
}) {
return loaded?.call(cards, currentIndex, flippedCards, isShuffled);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function(List<GameCardDto> cards, int currentIndex,
Map<int, bool> flippedCards, bool isShuffled)?
loaded,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(cards, currentIndex, flippedCards, isShuffled);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Initial value) initial,
required TResult Function(_Loaded value) loaded,
}) {
return loaded(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Initial value)? initial,
TResult? Function(_Loaded value)? loaded,
}) {
return loaded?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_Loaded value)? loaded,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(this);
}
return orElse();
}
final List<GameCardDto> _cards;
List<GameCardDto> 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<GameCardDto> cards,
required final int currentIndex,
required final Map<int, bool> flippedCards,
required final bool isShuffled}) = _$LoadedImpl;
List<GameCardDto> get cards;
int get currentIndex;
Map<int, bool> get flippedCards;
bool get isShuffled;
@JsonKey(ignore: true)
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
final int currentIndex;
final Map<String, bool> _flippedCards;
Map<String, bool> 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<GameCardDto> cards, int currentIndex, Map<String, bool> 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<GameCardDto>,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<String, bool>,isShuffled: null == isShuffled ? _self.isShuffled : isShuffled // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
// dart format on

View file

@ -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<int> favorites,
required Set<String> favorites,
}) = _Loaded;
}
@ -30,11 +30,8 @@ class FavoritesStateManager extends StateManager<FavoritesState> {
log('Loading favorites', name: 'FavoritesStateManager');
try {
final favoritesList = _sharedPreferences.getStringList(_favoritesKey) ?? [];
final favorites = favoritesList
.map((e) => int.tryParse(e))
.whereType<int>()
.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<FavoritesState> {
});
/// Toggle favorite status for a card
Future<void> toggleFavorite(int cardId) => handle((emit) async {
Future<void> 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<FavoritesState> {
return;
}
final Set<int> updatedFavorites;
final Set<String> 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<FavoritesState> {
// 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<FavoritesState> {
});
/// 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<FavoritesState> {
}
/// Get all favorite IDs
Set<int> get favorites {
Set<String> get favorites {
final currentState = state;
if (currentState is _Loaded) {
return currentState.favorites;

View file

@ -1,5 +1,5 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
@ -9,310 +9,276 @@ part of 'favorites_state_manager.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$FavoritesState {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() initial,
required TResult Function(Set<int> favorites) loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? initial,
TResult? Function(Set<int> favorites)? loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function(Set<int> favorites)? loaded,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Initial value) initial,
required TResult Function(_Loaded value) loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Initial value)? initial,
TResult? Function(_Loaded value)? loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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 extends Object?>({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<TResult extends Object?>({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 extends Object?>({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 extends Object?>({TResult Function()? initial,TResult Function( Set<String> 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<TResult extends Object?>({required TResult Function() initial,required TResult Function( Set<String> 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 extends Object?>({TResult? Function()? initial,TResult? Function( Set<String> 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<TResult extends Object?>({
required TResult Function() initial,
required TResult Function(Set<int> favorites) loaded,
}) {
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? initial,
TResult? Function(Set<int> favorites)? loaded,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function(Set<int> favorites)? loaded,
required TResult orElse(),
}) {
if (initial != null) {
return initial();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Initial value) initial,
required TResult Function(_Loaded value) loaded,
}) {
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Initial value)? initial,
TResult? Function(_Loaded value)? loaded,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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<int> 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<int>,
));
}
}
/// @nodoc
class _$LoadedImpl implements _Loaded {
const _$LoadedImpl({required final Set<int> favorites})
: _favorites = favorites;
final Set<int> _favorites;
@override
Set<int> get favorites {
if (_favorites is EqualUnmodifiableSetView) return _favorites;
// ignore: implicit_dynamic_type
return EqualUnmodifiableSetView(_favorites);
}
class _Loaded implements FavoritesState {
const _Loaded({required final Set<String> 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<TResult extends Object?>({
required TResult Function() initial,
required TResult Function(Set<int> favorites) loaded,
}) {
return loaded(favorites);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? initial,
TResult? Function(Set<int> favorites)? loaded,
}) {
return loaded?.call(favorites);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function(Set<int> favorites)? loaded,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(favorites);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Initial value) initial,
required TResult Function(_Loaded value) loaded,
}) {
return loaded(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Initial value)? initial,
TResult? Function(_Loaded value)? loaded,
}) {
return loaded?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_Loaded value)? loaded,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(this);
}
return orElse();
}
final Set<String> _favorites;
Set<String> 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<int> favorites}) = _$LoadedImpl;
Set<int> 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<String> 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<String>,
));
}
}
// dart format on

View file

@ -1,5 +1,5 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
@ -9,481 +9,350 @@ part of 'games_state_manager.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$GamesState {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() loading,
required TResult Function(List<GameDto> games, String searchQuery) loaded,
required TResult Function(String message) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loading,
TResult? Function(List<GameDto> games, String searchQuery)? loaded,
TResult? Function(String message)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loading,
TResult Function(List<GameDto> games, String searchQuery)? loaded,
TResult Function(String message)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Loading value) loading,
required TResult Function(_Loaded value) loaded,
required TResult Function(_Error value) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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 extends Object?>({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<TResult extends Object?>({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 extends Object?>({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 extends Object?>({TResult Function()? loading,TResult Function( List<GameDto> 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<TResult extends Object?>({required TResult Function() loading,required TResult Function( List<GameDto> 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 extends Object?>({TResult? Function()? loading,TResult? Function( List<GameDto> 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<TResult extends Object?>({
required TResult Function() loading,
required TResult Function(List<GameDto> games, String searchQuery) loaded,
required TResult Function(String message) error,
}) {
return loading();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loading,
TResult? Function(List<GameDto> games, String searchQuery)? loaded,
TResult? Function(String message)? error,
}) {
return loading?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loading,
TResult Function(List<GameDto> games, String searchQuery)? loaded,
TResult Function(String message)? error,
required TResult orElse(),
}) {
if (loading != null) {
return loading();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
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 extends Object?>({
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
}) {
return loading?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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<GameDto> games, this.searchQuery = ''}): _games = games;
final List<GameDto> _games;
List<GameDto> 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<GameDto> games, String searchQuery});
abstract mixin class _$LoadedCopyWith<$Res> implements $GamesStateCopyWith<$Res> {
factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl;
@useResult
$Res call({
List<GameDto> 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<GameDto>,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<GameDto>,
searchQuery: null == searchQuery
? _value.searchQuery
: searchQuery // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$LoadedImpl implements _Loaded {
const _$LoadedImpl(
{required final List<GameDto> games, this.searchQuery = ''})
: _games = games;
final List<GameDto> _games;
@override
List<GameDto> 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;
@override
String toString() {
return 'GamesState.loaded(games: $games, searchQuery: $searchQuery)';
}
final String message;
@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));
}
/// 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
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<TResult extends Object?>({
required TResult Function() loading,
required TResult Function(List<GameDto> games, String searchQuery) loaded,
required TResult Function(String message) error,
}) {
return loaded(games, searchQuery);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loading,
TResult? Function(List<GameDto> games, String searchQuery)? loaded,
TResult? Function(String message)? error,
}) {
return loaded?.call(games, searchQuery);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loading,
TResult Function(List<GameDto> 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<TResult extends Object?>({
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 extends Object?>({
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
}) {
return loaded?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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<GameDto> games,
final String searchQuery}) = _$LoadedImpl;
List<GameDto> 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<TResult extends Object?>({
required TResult Function() loading,
required TResult Function(List<GameDto> games, String searchQuery) loaded,
required TResult Function(String message) error,
}) {
return error(message);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loading,
TResult? Function(List<GameDto> games, String searchQuery)? loaded,
TResult? Function(String message)? error,
}) {
return error?.call(message);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loading,
TResult Function(List<GameDto> games, String searchQuery)? loaded,
TResult Function(String message)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(message);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
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 extends Object?>({
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
}) {
return error?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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

View file

@ -1,5 +1,5 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
@ -9,497 +9,350 @@ part of 'packs_state_manager.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$PacksState {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() loading,
required TResult Function(
List<CardPackPreviewDto> packs, String searchQuery)
loaded,
required TResult Function(String message) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loading,
TResult? Function(List<CardPackPreviewDto> packs, String searchQuery)?
loaded,
TResult? Function(String message)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loading,
TResult Function(List<CardPackPreviewDto> packs, String searchQuery)?
loaded,
TResult Function(String message)? error,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Loading value) loading,
required TResult Function(_Loaded value) loaded,
required TResult Function(_Error value) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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 extends Object?>({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<TResult extends Object?>({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 extends Object?>({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 extends Object?>({TResult Function()? loading,TResult Function( List<CardPackPreviewDto> 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<TResult extends Object?>({required TResult Function() loading,required TResult Function( List<CardPackPreviewDto> 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 extends Object?>({TResult? Function()? loading,TResult? Function( List<CardPackPreviewDto> 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<TResult extends Object?>({
required TResult Function() loading,
required TResult Function(
List<CardPackPreviewDto> packs, String searchQuery)
loaded,
required TResult Function(String message) error,
}) {
return loading();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loading,
TResult? Function(List<CardPackPreviewDto> packs, String searchQuery)?
loaded,
TResult? Function(String message)? error,
}) {
return loading?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loading,
TResult Function(List<CardPackPreviewDto> packs, String searchQuery)?
loaded,
TResult Function(String message)? error,
required TResult orElse(),
}) {
if (loading != null) {
return loading();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
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 extends Object?>({
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
}) {
return loading?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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<CardPackPreviewDto> packs, this.searchQuery = ''}): _packs = packs;
final List<CardPackPreviewDto> _packs;
List<CardPackPreviewDto> 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<CardPackPreviewDto> packs, String searchQuery});
abstract mixin class _$LoadedCopyWith<$Res> implements $PacksStateCopyWith<$Res> {
factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl;
@useResult
$Res call({
List<CardPackPreviewDto> 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<CardPackPreviewDto>,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<CardPackPreviewDto>,
searchQuery: null == searchQuery
? _value.searchQuery
: searchQuery // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$LoadedImpl implements _Loaded {
const _$LoadedImpl(
{required final List<CardPackPreviewDto> packs, this.searchQuery = ''})
: _packs = packs;
final List<CardPackPreviewDto> _packs;
@override
List<CardPackPreviewDto> 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;
@override
String toString() {
return 'PacksState.loaded(packs: $packs, searchQuery: $searchQuery)';
}
final String message;
@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));
}
/// 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
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<TResult extends Object?>({
required TResult Function() loading,
required TResult Function(
List<CardPackPreviewDto> packs, String searchQuery)
loaded,
required TResult Function(String message) error,
}) {
return loaded(packs, searchQuery);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loading,
TResult? Function(List<CardPackPreviewDto> packs, String searchQuery)?
loaded,
TResult? Function(String message)? error,
}) {
return loaded?.call(packs, searchQuery);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loading,
TResult Function(List<CardPackPreviewDto> 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<TResult extends Object?>({
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 extends Object?>({
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
}) {
return loaded?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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<CardPackPreviewDto> packs,
final String searchQuery}) = _$LoadedImpl;
List<CardPackPreviewDto> 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<TResult extends Object?>({
required TResult Function() loading,
required TResult Function(
List<CardPackPreviewDto> packs, String searchQuery)
loaded,
required TResult Function(String message) error,
}) {
return error(message);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loading,
TResult? Function(List<CardPackPreviewDto> packs, String searchQuery)?
loaded,
TResult? Function(String message)? error,
}) {
return error?.call(message);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loading,
TResult Function(List<CardPackPreviewDto> packs, String searchQuery)?
loaded,
TResult Function(String message)? error,
required TResult orElse(),
}) {
if (error != null) {
return error(message);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
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 extends Object?>({
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
}) {
return error?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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

View file

@ -1,5 +1,5 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
@ -9,428 +9,308 @@ part of 'user_state_manager.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$UserState {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() guest,
required TResult Function(UserDto user) authenticated,
required TResult Function() loading,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? guest,
TResult? Function(UserDto user)? authenticated,
TResult? Function()? loading,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? guest,
TResult Function(UserDto user)? authenticated,
TResult Function()? loading,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Guest value) guest,
required TResult Function(_Authenticated value) authenticated,
required TResult Function(_Loading value) loading,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Guest value)? guest,
TResult? Function(_Authenticated value)? authenticated,
TResult? Function(_Loading value)? loading,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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 extends Object?>({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<TResult extends Object?>({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 extends Object?>({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 extends Object?>({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<TResult extends Object?>({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 extends Object?>({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<TResult extends Object?>({
required TResult Function() guest,
required TResult Function(UserDto user) authenticated,
required TResult Function() loading,
}) {
return guest();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? guest,
TResult? Function(UserDto user)? authenticated,
TResult? Function()? loading,
}) {
return guest?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
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<TResult extends Object?>({
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 extends Object?>({
TResult? Function(_Guest value)? guest,
TResult? Function(_Authenticated value)? authenticated,
TResult? Function(_Loading value)? loading,
}) {
return guest?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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<TResult extends Object?>({
required TResult Function() guest,
required TResult Function(UserDto user) authenticated,
required TResult Function() loading,
}) {
return authenticated(user);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? guest,
TResult? Function(UserDto user)? authenticated,
TResult? Function()? loading,
}) {
return authenticated?.call(user);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
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<TResult extends Object?>({
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 extends Object?>({
TResult? Function(_Guest value)? guest,
TResult? Function(_Authenticated value)? authenticated,
TResult? Function(_Loading value)? loading,
}) {
return authenticated?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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<TResult extends Object?>({
required TResult Function() guest,
required TResult Function(UserDto user) authenticated,
required TResult Function() loading,
}) {
return loading();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? guest,
TResult? Function(UserDto user)? authenticated,
TResult? Function()? loading,
}) {
return loading?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
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<TResult extends Object?>({
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 extends Object?>({
TResult? Function(_Guest value)? guest,
TResult? Function(_Authenticated value)? authenticated,
TResult? Function(_Loading value)? loading,
}) {
return loading?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
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

View file

@ -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';

View file

@ -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';

View file

@ -48,7 +48,7 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
List<GameCardDto> _shuffledCards = [];
int _shuffleAnimationKey = 0;
double _shuffleAnimationTurns = 0;
Map<int, int> _previousCardIndexById = {};
Map<String, int> _previousCardIndexById = {};
int _lastAnimatedShuffleKey = 0;
bool _isNavigatingToPurchase = false;
@ -539,9 +539,9 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
final shouldAnimateMovement = _lastAnimatedShuffleKey != _shuffleAnimationKey;
final previousIndexById = shouldAnimateMovement
? Map<int, int>.from(_previousCardIndexById)
: const <int, int>{};
final currentIndexById = <int, int>{
? Map<String, int>.from(_previousCardIndexById)
: const <String, int>{};
final currentIndexById = <String, int>{
for (var i = 0; i < displayCards.length; i++) displayCards[i].id: i,
};
@ -587,7 +587,7 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
List<GameCardDto> cards,
Color packColor,
bool animateMovement,
Map<int, int> previousIndexById,
Map<String, int> previousIndexById,
) {
const spacing = 8.0;
const childAspectRatio = 0.8;
@ -644,7 +644,7 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
List<GameCardDto> cards,
Color packColor,
bool animateMovement,
Map<int, int> previousIndexById,
Map<String, int> previousIndexById,
) {
const itemHeight = 100.0;
const spacing = 8.0;
@ -943,7 +943,7 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
}
/// Marks a card as learned
Future<void> _markCardLearned(int cardId) async {
Future<void> _markCardLearned(String cardId) async {
try {
final appScope = ScopeProvider.of<AppScopeContainer>(
context,
@ -1024,7 +1024,7 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
}
/// Проверяет, является ли карточка избранной
bool _isCardFavorite(int cardId) {
bool _isCardFavorite(String cardId) {
final appScope = ScopeProvider.of<AppScopeContainer>(
context,
listen: false,
@ -1036,7 +1036,7 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
}
/// Переключает статус избранного для карточки
Future<void> _toggleCardFavorite(int cardId) async {
Future<void> _toggleCardFavorite(String cardId) async {
final appScope = ScopeProvider.of<AppScopeContainer>(
context,
listen: false,

View file

@ -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';

View file

@ -40,7 +40,7 @@ class CardViewer extends StatefulWidget {
class _CardViewerState extends State<CardViewer> {
late PageController _pageController;
late int _currentIndex;
final Map<int, bool> _flippedCards = {};
final Map<String, bool> _flippedCards = {};
final FocusNode _focusNode = FocusNode();
@override
@ -62,11 +62,11 @@ class _CardViewerState extends State<CardViewer> {
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<CardViewer> {
}
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<CardVoiceControls> {
late Future<List<VoiceDto>> _voicesFuture;
final AudioPlayer _player = AudioPlayer();
bool _isPlaying = false;
int? _currentVoiceId;
String? _currentVoiceId;
String? _playError;
@override

View file

@ -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<int, int> previousIndexById,
required int cardId,
required Map<String, int> 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<int, int> previousIndexById,
required int cardId,
required Map<String, int> previousIndexById,
required String cardId,
required int currentIndex,
required double itemExtent,
required double spacing,

View file

@ -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:

View file

@ -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