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
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:
parent
115fa26d46
commit
adc2d2e2f9
34 changed files with 5861 additions and 8242 deletions
|
|
@ -18,8 +18,8 @@ dependencies:
|
||||||
dio: ^5.3.3
|
dio: ^5.3.3
|
||||||
|
|
||||||
# Immutable data models
|
# Immutable data models
|
||||||
freezed_annotation: ^2.4.1
|
freezed_annotation: ^3.0.1
|
||||||
json_annotation: ^4.7.0
|
json_annotation: ^4.9.0
|
||||||
|
|
||||||
# Common utilities
|
# Common utilities
|
||||||
meta: ^1.8.0
|
meta: ^1.8.0
|
||||||
|
|
@ -30,7 +30,7 @@ dev_dependencies:
|
||||||
|
|
||||||
# Code generation
|
# Code generation
|
||||||
build_runner: ^2.4.13
|
build_runner: ^2.4.13
|
||||||
freezed: ^2.4.5
|
freezed: ^3.0.6
|
||||||
json_serializable: ^6.8.0
|
json_serializable: ^6.8.0
|
||||||
|
|
||||||
# Linting
|
# Linting
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ import '../user/google_api.dart' as _i972;
|
||||||
import '../v2/admin_analytics_api_v2.dart' as _i368;
|
import '../v2/admin_analytics_api_v2.dart' as _i368;
|
||||||
import '../v2/admin_auth_api_v2.dart' as _i483;
|
import '../v2/admin_auth_api_v2.dart' as _i483;
|
||||||
import '../v2/admin_cards_api_v2.dart' as _i922;
|
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/auth_api_v2.dart' as _i52;
|
||||||
import '../v2/discounts_api_v2.dart' as _i858;
|
import '../v2/discounts_api_v2.dart' as _i858;
|
||||||
import '../v2/jwt_service.dart' as _i108;
|
import '../v2/jwt_service.dart' as _i108;
|
||||||
|
|
@ -104,6 +105,9 @@ extension GetItInjectableX on _i174.GetIt {
|
||||||
gh.factory<_i922.AdminCardsApiV2>(
|
gh.factory<_i922.AdminCardsApiV2>(
|
||||||
() => _i922.AdminCardsApiV2(gh<_i1072.AppDatabase>()),
|
() => _i922.AdminCardsApiV2(gh<_i1072.AppDatabase>()),
|
||||||
);
|
);
|
||||||
|
gh.factory<_i1015.AdminPacksApiV2>(
|
||||||
|
() => _i1015.AdminPacksApiV2(gh<_i1072.AppDatabase>()),
|
||||||
|
);
|
||||||
gh.lazySingleton<_i964.SubscriptionsApiV2>(
|
gh.lazySingleton<_i964.SubscriptionsApiV2>(
|
||||||
() => _i964.SubscriptionsApiV2(gh<_i377.SubscriptionManager>()),
|
() => _i964.SubscriptionsApiV2(gh<_i377.SubscriptionManager>()),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ import 'package:shelf_router/shelf_router.dart';
|
||||||
// import 'v2/ads_api_v2.dart'; // disabled
|
// import 'v2/ads_api_v2.dart'; // disabled
|
||||||
import 'v2/admin_analytics_api_v2.dart';
|
import 'v2/admin_analytics_api_v2.dart';
|
||||||
import 'v2/admin_auth_api_v2.dart';
|
import 'v2/admin_auth_api_v2.dart';
|
||||||
// import 'v2/admin_cards_api_v2.dart'; // disabled
|
import 'v2/admin_cards_api_v2.dart';
|
||||||
// import 'v2/admin_packs_api_v2.dart'; // disabled
|
import 'v2/admin_packs_api_v2.dart';
|
||||||
// import 'v2/admin_users_api_v2.dart'; // disabled
|
// import 'v2/admin_users_api_v2.dart'; // disabled
|
||||||
import 'v2/auth_api_v2.dart';
|
import 'v2/auth_api_v2.dart';
|
||||||
import 'v2/discounts_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<AuthApiV2>().router);
|
||||||
v2Router.mount('/', getIt.get<AdminAuthApiV2>().router);
|
v2Router.mount('/', getIt.get<AdminAuthApiV2>().router);
|
||||||
v2Router.mount('/', getIt.get<AdminAnalyticsApiV2>().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<PacksApiV2>().router); // disabled
|
||||||
v2Router.mount('/', getIt.get<TestsApiV2>().router);
|
v2Router.mount('/', getIt.get<TestsApiV2>().router);
|
||||||
// v2Router.mount('/', getIt.get<GamesApiV2>().router); // disabled
|
// v2Router.mount('/', getIt.get<GamesApiV2>().router); // disabled
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ import 'package:drift_postgres/drift_postgres.dart';
|
||||||
import 'package:shelf/shelf.dart';
|
import 'package:shelf/shelf.dart';
|
||||||
import 'package:shelf_router/shelf_router.dart';
|
import 'package:shelf_router/shelf_router.dart';
|
||||||
import 'package:mnemo_cards_backend/database/database.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:injectable/injectable.dart';
|
||||||
import 'package:drift/drift.dart' as drift;
|
import 'package:drift/drift.dart' as drift;
|
||||||
|
|
||||||
|
|
@ -16,39 +19,94 @@ class AdminCardsApiV2 {
|
||||||
|
|
||||||
const AdminCardsApiV2(this._db);
|
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 {
|
Future<Response> getAllCards(Request request) async {
|
||||||
try {
|
try {
|
||||||
final packId = request.url.queryParameters['packId'];
|
final auth = await _ensureAdmin(request);
|
||||||
final limit = int.tryParse(request.url.queryParameters['limit'] ?? '50') ?? 50;
|
if (auth.statusCode != 200) {
|
||||||
final offset = int.tryParse(request.url.queryParameters['offset'] ?? '0') ?? 0;
|
return auth;
|
||||||
|
}
|
||||||
|
|
||||||
final cards = packId != null
|
final queryParams = request.url.queryParameters;
|
||||||
? await _db.packDao.getPackCards(packId)
|
|
||||||
: await _db.packDao.getAllCards(limit: limit, offset: offset);
|
|
||||||
|
|
||||||
final total = packId != null
|
// Parse pagination parameters
|
||||||
? cards.length
|
final page = int.tryParse(queryParams['page'] ?? '1') ?? 1;
|
||||||
: await _db.packDao.countCards();
|
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(
|
return Response.ok(
|
||||||
json.encode({
|
json.encode({
|
||||||
'cards': cards.map((card) => {
|
'items': paginatedCards.map((card) {
|
||||||
'id': card.id,
|
// Try to parse ID as int, fallback to 0 if it's not a number
|
||||||
'packId': card.packId,
|
final cardId = int.tryParse(card.id) ?? 0;
|
||||||
'original': card.original,
|
return {
|
||||||
'translation': card.translation,
|
'id': cardId,
|
||||||
'mnemo': card.mnemo,
|
'packId': card.packId,
|
||||||
'image': card.image,
|
'original': card.original,
|
||||||
'back': card.back,
|
'translation': card.translation,
|
||||||
'transcription': card.transcription,
|
'mnemo': card.mnemo,
|
||||||
'createdAt': card.createdAt.dateTime.toIso8601String(),
|
'image': card.image,
|
||||||
|
'back': card.back,
|
||||||
|
'transcription': card.transcription,
|
||||||
|
'imageBack': card.imageBack,
|
||||||
|
};
|
||||||
}).toList(),
|
}).toList(),
|
||||||
'total': total,
|
'total': total,
|
||||||
|
'page': page,
|
||||||
|
'limit': limit,
|
||||||
|
'totalPages': totalPages,
|
||||||
}),
|
}),
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: {'Content-Type': 'application/json'},
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e, s) {
|
||||||
|
print('Error in getAllCards: $e\n$s');
|
||||||
return Response.internalServerError(
|
return Response.internalServerError(
|
||||||
body: json.encode({'error': e.toString()}),
|
body: json.encode({'error': e.toString()}),
|
||||||
headers: {'Content-Type': 'application/json'},
|
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 {
|
Future<Response> getCard(Request request, String cardId) async {
|
||||||
try {
|
try {
|
||||||
if (cardId.isEmpty) {
|
if (cardId.isEmpty) {
|
||||||
|
|
@ -85,7 +145,7 @@ class AdminCardsApiV2 {
|
||||||
'back': card.back,
|
'back': card.back,
|
||||||
'transcription': card.transcription,
|
'transcription': card.transcription,
|
||||||
'createdAt': card.createdAt.dateTime.toIso8601String(),
|
'createdAt': card.createdAt.dateTime.toIso8601String(),
|
||||||
'updatedAt': card.updatedAt?.dateTime.toIso8601String(),
|
'updatedAt': card.updatedAt.dateTime.toIso8601String(),
|
||||||
}),
|
}),
|
||||||
headers: {'Content-Type': 'application/json'},
|
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 {
|
Future<Response> createCard(Request request) async {
|
||||||
try {
|
try {
|
||||||
final body = await request.readAsString();
|
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 {
|
Future<Response> updateCard(Request request, String cardId) async {
|
||||||
try {
|
try {
|
||||||
if (cardId.isEmpty) {
|
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 {
|
Future<Response> deleteCard(Request request, String cardId) async {
|
||||||
try {
|
try {
|
||||||
if (cardId.isEmpty) {
|
if (cardId.isEmpty) {
|
||||||
|
|
@ -197,5 +263,5 @@ class AdminCardsApiV2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Handler get handler => _$AdminCardsApiV2Router(this);
|
Router get router => _$AdminCardsApiV2Router(this);
|
||||||
}
|
}
|
||||||
|
|
@ -8,10 +8,10 @@ part of 'admin_cards_api_v2.dart';
|
||||||
|
|
||||||
Router _$AdminCardsApiV2Router(AdminCardsApiV2 service) {
|
Router _$AdminCardsApiV2Router(AdminCardsApiV2 service) {
|
||||||
final router = Router();
|
final router = Router();
|
||||||
router.add('GET', r'/cards', service.getAllCards);
|
router.add('GET', r'/admin/cards', service.getAllCards);
|
||||||
router.add('GET', r'/cards/<cardId>', service.getCard);
|
router.add('GET', r'/admin/cards/<cardId>', service.getCard);
|
||||||
router.add('POST', r'/cards', service.createCard);
|
router.add('POST', r'/admin/cards', service.createCard);
|
||||||
router.add('PUT', r'/cards/<cardId>', service.updateCard);
|
router.add('PUT', r'/admin/cards/<cardId>', service.updateCard);
|
||||||
router.add('DELETE', r'/cards/<cardId>', service.deleteCard);
|
router.add('DELETE', r'/admin/cards/<cardId>', service.deleteCard);
|
||||||
return router;
|
return router;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ part 'user_settings_dto.g.dart';
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
@CopyWith()
|
@CopyWith()
|
||||||
class UserSettingsDto {
|
class UserSettingsDto {
|
||||||
final Map<int, PackCardsOrderDto> packCardsOrder;
|
final Map<String, PackCardsOrderDto> packCardsOrder;
|
||||||
|
|
||||||
UserSettingsDto({this.packCardsOrder = const {}});
|
UserSettingsDto({this.packCardsOrder = const {}});
|
||||||
|
|
||||||
|
|
@ -19,10 +19,10 @@ class UserSettingsDto {
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
@CopyWith()
|
@CopyWith()
|
||||||
class PackCardsOrderDto {
|
class PackCardsOrderDto {
|
||||||
final int packId;
|
final String packId;
|
||||||
final List<int> cardsOrder;
|
final List<int> cardsOrder;
|
||||||
|
|
||||||
PackCardsOrderDto({this.packId = -1, this.cardsOrder = const []});
|
PackCardsOrderDto({this.packId = '', this.cardsOrder = const []});
|
||||||
|
|
||||||
factory PackCardsOrderDto.fromJson(Map<String, dynamic> json) =>
|
factory PackCardsOrderDto.fromJson(Map<String, dynamic> json) =>
|
||||||
_$PackCardsOrderDtoFromJson(json);
|
_$PackCardsOrderDtoFromJson(json);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ part of 'user_settings_dto.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
abstract class _$UserSettingsDtoCWProxy {
|
abstract class _$UserSettingsDtoCWProxy {
|
||||||
UserSettingsDto packCardsOrder(Map<int, PackCardsOrderDto> packCardsOrder);
|
UserSettingsDto packCardsOrder(Map<String, PackCardsOrderDto> packCardsOrder);
|
||||||
|
|
||||||
/// Creates a new instance with the provided field values.
|
/// 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)`.
|
/// 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
|
/// ```dart
|
||||||
/// UserSettingsDto(...).copyWith(id: 12, name: "My name")
|
/// UserSettingsDto(...).copyWith(id: 12, name: "My name")
|
||||||
/// ```
|
/// ```
|
||||||
UserSettingsDto call({Map<int, PackCardsOrderDto> packCardsOrder});
|
UserSettingsDto call({Map<String, PackCardsOrderDto> packCardsOrder});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Callable proxy for `copyWith` functionality.
|
/// Callable proxy for `copyWith` functionality.
|
||||||
|
|
@ -27,8 +27,9 @@ class _$UserSettingsDtoCWProxyImpl implements _$UserSettingsDtoCWProxy {
|
||||||
final UserSettingsDto _value;
|
final UserSettingsDto _value;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
UserSettingsDto packCardsOrder(Map<int, PackCardsOrderDto> packCardsOrder) =>
|
UserSettingsDto packCardsOrder(
|
||||||
call(packCardsOrder: packCardsOrder);
|
Map<String, PackCardsOrderDto> packCardsOrder,
|
||||||
|
) => call(packCardsOrder: packCardsOrder);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
/// Creates a new instance with the provided field values.
|
/// Creates a new instance with the provided field values.
|
||||||
|
|
@ -47,7 +48,7 @@ class _$UserSettingsDtoCWProxyImpl implements _$UserSettingsDtoCWProxy {
|
||||||
packCardsOrder == null
|
packCardsOrder == null
|
||||||
? _value.packCardsOrder
|
? _value.packCardsOrder
|
||||||
// ignore: cast_nullable_to_non_nullable
|
// 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 {
|
abstract class _$PackCardsOrderDtoCWProxy {
|
||||||
PackCardsOrderDto packId(int packId);
|
PackCardsOrderDto packId(String packId);
|
||||||
|
|
||||||
PackCardsOrderDto cardsOrder(List<int> cardsOrder);
|
PackCardsOrderDto cardsOrder(List<int> cardsOrder);
|
||||||
|
|
||||||
|
|
@ -71,7 +72,7 @@ abstract class _$PackCardsOrderDtoCWProxy {
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// PackCardsOrderDto(...).copyWith(id: 12, name: "My name")
|
/// 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.
|
/// Callable proxy for `copyWith` functionality.
|
||||||
|
|
@ -82,7 +83,7 @@ class _$PackCardsOrderDtoCWProxyImpl implements _$PackCardsOrderDtoCWProxy {
|
||||||
final PackCardsOrderDto _value;
|
final PackCardsOrderDto _value;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PackCardsOrderDto packId(int packId) => call(packId: packId);
|
PackCardsOrderDto packId(String packId) => call(packId: packId);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PackCardsOrderDto cardsOrder(List<int> cardsOrder) =>
|
PackCardsOrderDto cardsOrder(List<int> cardsOrder) =>
|
||||||
|
|
@ -104,7 +105,7 @@ class _$PackCardsOrderDtoCWProxyImpl implements _$PackCardsOrderDtoCWProxy {
|
||||||
packId: packId == const $CopyWithPlaceholder() || packId == null
|
packId: packId == const $CopyWithPlaceholder() || packId == null
|
||||||
? _value.packId
|
? _value.packId
|
||||||
// ignore: cast_nullable_to_non_nullable
|
// ignore: cast_nullable_to_non_nullable
|
||||||
: packId as int,
|
: packId as String,
|
||||||
cardsOrder:
|
cardsOrder:
|
||||||
cardsOrder == const $CopyWithPlaceholder() || cardsOrder == null
|
cardsOrder == const $CopyWithPlaceholder() || cardsOrder == null
|
||||||
? _value.cardsOrder
|
? _value.cardsOrder
|
||||||
|
|
@ -131,7 +132,7 @@ UserSettingsDto _$UserSettingsDtoFromJson(Map<String, dynamic> json) =>
|
||||||
packCardsOrder:
|
packCardsOrder:
|
||||||
(json['packCardsOrder'] as Map<String, dynamic>?)?.map(
|
(json['packCardsOrder'] as Map<String, dynamic>?)?.map(
|
||||||
(k, e) => MapEntry(
|
(k, e) => MapEntry(
|
||||||
int.parse(k),
|
k,
|
||||||
PackCardsOrderDto.fromJson(e as Map<String, dynamic>),
|
PackCardsOrderDto.fromJson(e as Map<String, dynamic>),
|
||||||
),
|
),
|
||||||
) ??
|
) ??
|
||||||
|
|
@ -139,15 +140,11 @@ UserSettingsDto _$UserSettingsDtoFromJson(Map<String, dynamic> json) =>
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$UserSettingsDtoToJson(UserSettingsDto instance) =>
|
Map<String, dynamic> _$UserSettingsDtoToJson(UserSettingsDto instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{'packCardsOrder': instance.packCardsOrder};
|
||||||
'packCardsOrder': instance.packCardsOrder.map(
|
|
||||||
(k, e) => MapEntry(k.toString(), e),
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
PackCardsOrderDto _$PackCardsOrderDtoFromJson(Map<String, dynamic> json) =>
|
PackCardsOrderDto _$PackCardsOrderDtoFromJson(Map<String, dynamic> json) =>
|
||||||
PackCardsOrderDto(
|
PackCardsOrderDto(
|
||||||
packId: (json['packId'] as num?)?.toInt() ?? -1,
|
packId: json['packId'] as String? ?? '',
|
||||||
cardsOrder:
|
cardsOrder:
|
||||||
(json['cardsOrder'] as List<dynamic>?)
|
(json['cardsOrder'] as List<dynamic>?)
|
||||||
?.map((e) => (e as num).toInt())
|
?.map((e) => (e as num).toInt())
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ dependencies:
|
||||||
# firebase_crashlytics:
|
# firebase_crashlytics:
|
||||||
# firebase_storage:
|
# firebase_storage:
|
||||||
json_serializable:
|
json_serializable:
|
||||||
json_annotation: ^4.7.0
|
json_annotation: ^4.9.0
|
||||||
auto_size_text: ^3.0.0
|
auto_size_text: ^3.0.0
|
||||||
path_provider:
|
path_provider:
|
||||||
# google_fonts:
|
# google_fonts:
|
||||||
|
|
@ -44,7 +44,7 @@ dependencies:
|
||||||
story: ^1.1.0
|
story: ^1.1.0
|
||||||
flutter_screenutil: ^5.9.0
|
flutter_screenutil: ^5.9.0
|
||||||
fl_chart: ^0.68.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.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class ApiConfig {
|
||||||
///
|
///
|
||||||
/// Returns URL for loading card image by its ID
|
/// Returns URL for loading card image by its ID
|
||||||
/// Example: http://localhost:8000/pack/food/card/123/image
|
/// 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';
|
return '$baseUrl/pack/$packId/card/$cardId/image';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,17 +131,17 @@ class ApiConfigV2 {
|
||||||
|
|
||||||
/// GET /api/v2/packs/{packId}/cards/{cardId}/voices
|
/// GET /api/v2/packs/{packId}/cards/{cardId}/voices
|
||||||
/// Get card voices metadata
|
/// Get card voices metadata
|
||||||
static String packCardVoices(String packId, int cardId) =>
|
static String packCardVoices(String packId, String cardId) =>
|
||||||
'/packs/$packId/cards/$cardId/voices';
|
'/packs/$packId/cards/$cardId/voices';
|
||||||
|
|
||||||
/// GET /api/v2/packs/{packId}/card/{cardId}/image
|
/// GET /api/v2/packs/{packId}/card/{cardId}/image
|
||||||
/// Get card image
|
/// Get card image
|
||||||
static String packCardImage(String packId, int cardId) =>
|
static String packCardImage(String packId, String cardId) =>
|
||||||
'/packs/$packId/cards/$cardId/image';
|
'/packs/$packId/cards/$cardId/image';
|
||||||
|
|
||||||
/// GET /api/v2/voice/{voiceId}
|
/// GET /api/v2/voice/{voiceId}
|
||||||
/// Get voice file
|
/// Get voice file
|
||||||
static String voiceFile(int voiceId) => '/voice/$voiceId';
|
static String voiceFile(String voiceId) => '/voice/$voiceId';
|
||||||
|
|
||||||
/// GET /api/v2/packs/{packId}/tests
|
/// GET /api/v2/packs/{packId}/tests
|
||||||
/// Get tests for a pack
|
/// Get tests for a pack
|
||||||
|
|
@ -225,13 +225,13 @@ class ApiConfigV2 {
|
||||||
|
|
||||||
/// Get card image URL for a specific card
|
/// Get card image URL for a specific card
|
||||||
/// Returns: http://baseUrl/api/v2/packs/{packId}/cards/{cardId}/image
|
/// 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)}';
|
return '$baseUrl${packCardImage(packId, cardId)}';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get voice file URL by id
|
/// Get voice file URL by id
|
||||||
/// Returns: http://baseUrl/api/v2/voice/{voiceId}
|
/// Returns: http://baseUrl/api/v2/voice/{voiceId}
|
||||||
static String getVoiceFileUrl(int voiceId) {
|
static String getVoiceFileUrl(String voiceId) {
|
||||||
return '$baseUrl${voiceFile(voiceId)}';
|
return '$baseUrl${voiceFile(voiceId)}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ part 'game_question.g.dart';
|
||||||
|
|
||||||
/// Base class for all game questions
|
/// Base class for all game questions
|
||||||
@freezed
|
@freezed
|
||||||
class GameQuestion with _$GameQuestion {
|
abstract class GameQuestion with _$GameQuestion {
|
||||||
const factory GameQuestion.multipleChoice(MultipleChoiceQuestion question) =
|
const factory GameQuestion.multipleChoice(MultipleChoiceQuestion question) =
|
||||||
GameQuestionMultipleChoice;
|
GameQuestionMultipleChoice;
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ class GameQuestion with _$GameQuestion {
|
||||||
|
|
||||||
/// Multiple choice question - user selects one correct answer from options
|
/// Multiple choice question - user selects one correct answer from options
|
||||||
@freezed
|
@freezed
|
||||||
class MultipleChoiceQuestion with _$MultipleChoiceQuestion {
|
abstract class MultipleChoiceQuestion with _$MultipleChoiceQuestion {
|
||||||
const factory MultipleChoiceQuestion({
|
const factory MultipleChoiceQuestion({
|
||||||
required String id,
|
required String id,
|
||||||
required String question,
|
required String question,
|
||||||
|
|
@ -42,7 +42,7 @@ class MultipleChoiceQuestion with _$MultipleChoiceQuestion {
|
||||||
|
|
||||||
/// Input letters question - user fills in letters to form a word
|
/// Input letters question - user fills in letters to form a word
|
||||||
@freezed
|
@freezed
|
||||||
class InputLettersQuestion with _$InputLettersQuestion {
|
abstract class InputLettersQuestion with _$InputLettersQuestion {
|
||||||
const factory InputLettersQuestion({
|
const factory InputLettersQuestion({
|
||||||
required String id,
|
required String id,
|
||||||
required String template, // e.g., "H _ _ L _"
|
required String template, // e.g., "H _ _ L _"
|
||||||
|
|
@ -59,7 +59,7 @@ class InputLettersQuestion with _$InputLettersQuestion {
|
||||||
|
|
||||||
/// Match question - user connects items from two columns
|
/// Match question - user connects items from two columns
|
||||||
@freezed
|
@freezed
|
||||||
class MatchQuestion with _$MatchQuestion {
|
abstract class MatchQuestion with _$MatchQuestion {
|
||||||
const factory MatchQuestion({
|
const factory MatchQuestion({
|
||||||
required String id,
|
required String id,
|
||||||
required String question,
|
required String question,
|
||||||
|
|
@ -77,7 +77,7 @@ class MatchQuestion with _$MatchQuestion {
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class MatchItem with _$MatchItem {
|
abstract class MatchItem with _$MatchItem {
|
||||||
const factory MatchItem({
|
const factory MatchItem({
|
||||||
required String id,
|
required String id,
|
||||||
required String text,
|
required String text,
|
||||||
|
|
@ -89,7 +89,7 @@ class MatchItem with _$MatchItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class MatchPair with _$MatchPair {
|
abstract class MatchPair with _$MatchPair {
|
||||||
const factory MatchPair({
|
const factory MatchPair({
|
||||||
required String leftId,
|
required String leftId,
|
||||||
required String rightId,
|
required String rightId,
|
||||||
|
|
@ -101,7 +101,7 @@ class MatchPair with _$MatchPair {
|
||||||
|
|
||||||
/// Matrix question - user fills in a grid/matrix
|
/// Matrix question - user fills in a grid/matrix
|
||||||
@freezed
|
@freezed
|
||||||
class MatrixQuestion with _$MatrixQuestion {
|
abstract class MatrixQuestion with _$MatrixQuestion {
|
||||||
const factory MatrixQuestion({
|
const factory MatrixQuestion({
|
||||||
required String id,
|
required String id,
|
||||||
required String question,
|
required String question,
|
||||||
|
|
@ -119,7 +119,7 @@ class MatrixQuestion with _$MatrixQuestion {
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class MatrixCell with _$MatrixCell {
|
abstract class MatrixCell with _$MatrixCell {
|
||||||
const factory MatrixCell({
|
const factory MatrixCell({
|
||||||
required int rowIndex,
|
required int rowIndex,
|
||||||
required int columnIndex,
|
required int columnIndex,
|
||||||
|
|
@ -132,7 +132,7 @@ class MatrixCell with _$MatrixCell {
|
||||||
|
|
||||||
/// Question result for tracking user answers
|
/// Question result for tracking user answers
|
||||||
@freezed
|
@freezed
|
||||||
class QuestionResult with _$QuestionResult {
|
abstract class QuestionResult with _$QuestionResult {
|
||||||
const factory QuestionResult({
|
const factory QuestionResult({
|
||||||
required String questionId,
|
required String questionId,
|
||||||
required String word,
|
required String word,
|
||||||
|
|
@ -149,7 +149,7 @@ class QuestionResult with _$QuestionResult {
|
||||||
|
|
||||||
/// Game session result
|
/// Game session result
|
||||||
@freezed
|
@freezed
|
||||||
class GameSessionResult with _$GameSessionResult {
|
abstract class GameSessionResult with _$GameSessionResult {
|
||||||
const factory GameSessionResult({
|
const factory GameSessionResult({
|
||||||
required String testId,
|
required String testId,
|
||||||
required List<QuestionResult> questionResults,
|
required List<QuestionResult> questionResults,
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -6,115 +6,110 @@ part of 'game_question.dart';
|
||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_$GameQuestionMultipleChoiceImpl _$$GameQuestionMultipleChoiceImplFromJson(
|
GameQuestionMultipleChoice _$GameQuestionMultipleChoiceFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json,
|
||||||
_$GameQuestionMultipleChoiceImpl(
|
) => GameQuestionMultipleChoice(
|
||||||
MultipleChoiceQuestion.fromJson(json['question'] as Map<String, dynamic>),
|
MultipleChoiceQuestion.fromJson(json['question'] as Map<String, dynamic>),
|
||||||
$type: json['runtimeType'] as String?,
|
$type: json['runtimeType'] as String?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$GameQuestionMultipleChoiceImplToJson(
|
Map<String, dynamic> _$GameQuestionMultipleChoiceToJson(
|
||||||
_$GameQuestionMultipleChoiceImpl instance) =>
|
GameQuestionMultipleChoice instance,
|
||||||
<String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'question': instance.question,
|
'question': instance.question,
|
||||||
'runtimeType': instance.$type,
|
'runtimeType': instance.$type,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$GameQuestionInputLettersImpl _$$GameQuestionInputLettersImplFromJson(
|
GameQuestionInputLetters _$GameQuestionInputLettersFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json,
|
||||||
_$GameQuestionInputLettersImpl(
|
) => GameQuestionInputLetters(
|
||||||
InputLettersQuestion.fromJson(json['question'] as Map<String, dynamic>),
|
InputLettersQuestion.fromJson(json['question'] as Map<String, dynamic>),
|
||||||
$type: json['runtimeType'] as String?,
|
$type: json['runtimeType'] as String?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$GameQuestionInputLettersImplToJson(
|
Map<String, dynamic> _$GameQuestionInputLettersToJson(
|
||||||
_$GameQuestionInputLettersImpl instance) =>
|
GameQuestionInputLetters instance,
|
||||||
<String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'question': instance.question,
|
'question': instance.question,
|
||||||
'runtimeType': instance.$type,
|
'runtimeType': instance.$type,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$GameQuestionMatchImpl _$$GameQuestionMatchImplFromJson(
|
GameQuestionMatch _$GameQuestionMatchFromJson(Map<String, dynamic> json) =>
|
||||||
Map<String, dynamic> json) =>
|
GameQuestionMatch(
|
||||||
_$GameQuestionMatchImpl(
|
|
||||||
MatchQuestion.fromJson(json['question'] as Map<String, dynamic>),
|
MatchQuestion.fromJson(json['question'] as Map<String, dynamic>),
|
||||||
$type: json['runtimeType'] as String?,
|
$type: json['runtimeType'] as String?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$GameQuestionMatchImplToJson(
|
Map<String, dynamic> _$GameQuestionMatchToJson(GameQuestionMatch instance) =>
|
||||||
_$GameQuestionMatchImpl instance) =>
|
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'question': instance.question,
|
'question': instance.question,
|
||||||
'runtimeType': instance.$type,
|
'runtimeType': instance.$type,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$GameQuestionMatrixImpl _$$GameQuestionMatrixImplFromJson(
|
GameQuestionMatrix _$GameQuestionMatrixFromJson(Map<String, dynamic> json) =>
|
||||||
Map<String, dynamic> json) =>
|
GameQuestionMatrix(
|
||||||
_$GameQuestionMatrixImpl(
|
|
||||||
MatrixQuestion.fromJson(json['question'] as Map<String, dynamic>),
|
MatrixQuestion.fromJson(json['question'] as Map<String, dynamic>),
|
||||||
$type: json['runtimeType'] as String?,
|
$type: json['runtimeType'] as String?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$GameQuestionMatrixImplToJson(
|
Map<String, dynamic> _$GameQuestionMatrixToJson(GameQuestionMatrix instance) =>
|
||||||
_$GameQuestionMatrixImpl instance) =>
|
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'question': instance.question,
|
'question': instance.question,
|
||||||
'runtimeType': instance.$type,
|
'runtimeType': instance.$type,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$MultipleChoiceQuestionImpl _$$MultipleChoiceQuestionImplFromJson(
|
_MultipleChoiceQuestion _$MultipleChoiceQuestionFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json,
|
||||||
_$MultipleChoiceQuestionImpl(
|
) => _MultipleChoiceQuestion(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
question: json['question'] as String,
|
question: json['question'] as String,
|
||||||
image: json['image'] as String?,
|
image: json['image'] as String?,
|
||||||
audio: json['audio'] as String?,
|
audio: json['audio'] as String?,
|
||||||
options:
|
options: (json['options'] as List<dynamic>).map((e) => e as String).toList(),
|
||||||
(json['options'] as List<dynamic>).map((e) => e as String).toList(),
|
correctAnswer: json['correctAnswer'] as String,
|
||||||
correctAnswer: json['correctAnswer'] as String,
|
word: json['word'] as String,
|
||||||
word: json['word'] as String,
|
type: json['type'] as String? ?? 'multipleChoice',
|
||||||
type: json['type'] as String? ?? 'multipleChoice',
|
);
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$$MultipleChoiceQuestionImplToJson(
|
Map<String, dynamic> _$MultipleChoiceQuestionToJson(
|
||||||
_$MultipleChoiceQuestionImpl instance) =>
|
_MultipleChoiceQuestion instance,
|
||||||
<String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'question': instance.question,
|
'question': instance.question,
|
||||||
'image': instance.image,
|
'image': instance.image,
|
||||||
'audio': instance.audio,
|
'audio': instance.audio,
|
||||||
'options': instance.options,
|
'options': instance.options,
|
||||||
'correctAnswer': instance.correctAnswer,
|
'correctAnswer': instance.correctAnswer,
|
||||||
'word': instance.word,
|
'word': instance.word,
|
||||||
'type': instance.type,
|
'type': instance.type,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$InputLettersQuestionImpl _$$InputLettersQuestionImplFromJson(
|
_InputLettersQuestion _$InputLettersQuestionFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json,
|
||||||
_$InputLettersQuestionImpl(
|
) => _InputLettersQuestion(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
template: json['template'] as String,
|
template: json['template'] as String,
|
||||||
image: json['image'] as String?,
|
image: json['image'] as String?,
|
||||||
audio: json['audio'] as String?,
|
audio: json['audio'] as String?,
|
||||||
correctAnswer: json['correctAnswer'] as String,
|
correctAnswer: json['correctAnswer'] as String,
|
||||||
word: json['word'] as String,
|
word: json['word'] as String,
|
||||||
type: json['type'] as String? ?? 'inputLetters',
|
type: json['type'] as String? ?? 'inputLetters',
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$InputLettersQuestionImplToJson(
|
Map<String, dynamic> _$InputLettersQuestionToJson(
|
||||||
_$InputLettersQuestionImpl instance) =>
|
_InputLettersQuestion instance,
|
||||||
<String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'template': instance.template,
|
'template': instance.template,
|
||||||
'image': instance.image,
|
'image': instance.image,
|
||||||
'audio': instance.audio,
|
'audio': instance.audio,
|
||||||
'correctAnswer': instance.correctAnswer,
|
'correctAnswer': instance.correctAnswer,
|
||||||
'word': instance.word,
|
'word': instance.word,
|
||||||
'type': instance.type,
|
'type': instance.type,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$MatchQuestionImpl _$$MatchQuestionImplFromJson(Map<String, dynamic> json) =>
|
_MatchQuestion _$MatchQuestionFromJson(Map<String, dynamic> json) =>
|
||||||
_$MatchQuestionImpl(
|
_MatchQuestion(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
question: json['question'] as String,
|
question: json['question'] as String,
|
||||||
image: json['image'] as String?,
|
image: json['image'] as String?,
|
||||||
|
|
@ -132,7 +127,7 @@ _$MatchQuestionImpl _$$MatchQuestionImplFromJson(Map<String, dynamic> json) =>
|
||||||
type: json['type'] as String? ?? 'match',
|
type: json['type'] as String? ?? 'match',
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$MatchQuestionImplToJson(_$MatchQuestionImpl instance) =>
|
Map<String, dynamic> _$MatchQuestionToJson(_MatchQuestion instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'question': instance.question,
|
'question': instance.question,
|
||||||
|
|
@ -145,34 +140,29 @@ Map<String, dynamic> _$$MatchQuestionImplToJson(_$MatchQuestionImpl instance) =>
|
||||||
'type': instance.type,
|
'type': instance.type,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$MatchItemImpl _$$MatchItemImplFromJson(Map<String, dynamic> json) =>
|
_MatchItem _$MatchItemFromJson(Map<String, dynamic> json) => _MatchItem(
|
||||||
_$MatchItemImpl(
|
id: json['id'] as String,
|
||||||
id: json['id'] as String,
|
text: json['text'] as String,
|
||||||
text: json['text'] as String,
|
image: json['image'] as String?,
|
||||||
image: json['image'] as String?,
|
);
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$$MatchItemImplToJson(_$MatchItemImpl instance) =>
|
Map<String, dynamic> _$MatchItemToJson(_MatchItem instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'text': instance.text,
|
'text': instance.text,
|
||||||
'image': instance.image,
|
'image': instance.image,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$MatchPairImpl _$$MatchPairImplFromJson(Map<String, dynamic> json) =>
|
_MatchPair _$MatchPairFromJson(Map<String, dynamic> json) => _MatchPair(
|
||||||
_$MatchPairImpl(
|
leftId: json['leftId'] as String,
|
||||||
leftId: json['leftId'] as String,
|
rightId: json['rightId'] as String,
|
||||||
rightId: json['rightId'] as String,
|
);
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$$MatchPairImplToJson(_$MatchPairImpl instance) =>
|
Map<String, dynamic> _$MatchPairToJson(_MatchPair instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{'leftId': instance.leftId, 'rightId': instance.rightId};
|
||||||
'leftId': instance.leftId,
|
|
||||||
'rightId': instance.rightId,
|
|
||||||
};
|
|
||||||
|
|
||||||
_$MatrixQuestionImpl _$$MatrixQuestionImplFromJson(Map<String, dynamic> json) =>
|
_MatrixQuestion _$MatrixQuestionFromJson(Map<String, dynamic> json) =>
|
||||||
_$MatrixQuestionImpl(
|
_MatrixQuestion(
|
||||||
id: json['id'] as String,
|
id: json['id'] as String,
|
||||||
question: json['question'] as String,
|
question: json['question'] as String,
|
||||||
image: json['image'] as String?,
|
image: json['image'] as String?,
|
||||||
|
|
@ -190,8 +180,7 @@ _$MatrixQuestionImpl _$$MatrixQuestionImplFromJson(Map<String, dynamic> json) =>
|
||||||
type: json['type'] as String? ?? 'matrix',
|
type: json['type'] as String? ?? 'matrix',
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$MatrixQuestionImplToJson(
|
Map<String, dynamic> _$MatrixQuestionToJson(_MatrixQuestion instance) =>
|
||||||
_$MatrixQuestionImpl instance) =>
|
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'question': instance.question,
|
'question': instance.question,
|
||||||
|
|
@ -204,22 +193,21 @@ Map<String, dynamic> _$$MatrixQuestionImplToJson(
|
||||||
'type': instance.type,
|
'type': instance.type,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$MatrixCellImpl _$$MatrixCellImplFromJson(Map<String, dynamic> json) =>
|
_MatrixCell _$MatrixCellFromJson(Map<String, dynamic> json) => _MatrixCell(
|
||||||
_$MatrixCellImpl(
|
rowIndex: (json['rowIndex'] as num).toInt(),
|
||||||
rowIndex: (json['rowIndex'] as num).toInt(),
|
columnIndex: (json['columnIndex'] as num).toInt(),
|
||||||
columnIndex: (json['columnIndex'] as num).toInt(),
|
value: json['value'] as String,
|
||||||
value: json['value'] as String,
|
);
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$$MatrixCellImplToJson(_$MatrixCellImpl instance) =>
|
Map<String, dynamic> _$MatrixCellToJson(_MatrixCell instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'rowIndex': instance.rowIndex,
|
'rowIndex': instance.rowIndex,
|
||||||
'columnIndex': instance.columnIndex,
|
'columnIndex': instance.columnIndex,
|
||||||
'value': instance.value,
|
'value': instance.value,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$QuestionResultImpl _$$QuestionResultImplFromJson(Map<String, dynamic> json) =>
|
_QuestionResult _$QuestionResultFromJson(Map<String, dynamic> json) =>
|
||||||
_$QuestionResultImpl(
|
_QuestionResult(
|
||||||
questionId: json['questionId'] as String,
|
questionId: json['questionId'] as String,
|
||||||
word: json['word'] as String,
|
word: json['word'] as String,
|
||||||
isCorrect: json['isCorrect'] as bool,
|
isCorrect: json['isCorrect'] as bool,
|
||||||
|
|
@ -233,8 +221,7 @@ _$QuestionResultImpl _$$QuestionResultImplFromJson(Map<String, dynamic> json) =>
|
||||||
: DateTime.parse(json['answeredAt'] as String),
|
: DateTime.parse(json['answeredAt'] as String),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$QuestionResultImplToJson(
|
Map<String, dynamic> _$QuestionResultToJson(_QuestionResult instance) =>
|
||||||
_$QuestionResultImpl instance) =>
|
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'questionId': instance.questionId,
|
'questionId': instance.questionId,
|
||||||
'word': instance.word,
|
'word': instance.word,
|
||||||
|
|
@ -245,9 +232,8 @@ Map<String, dynamic> _$$QuestionResultImplToJson(
|
||||||
'answeredAt': instance.answeredAt?.toIso8601String(),
|
'answeredAt': instance.answeredAt?.toIso8601String(),
|
||||||
};
|
};
|
||||||
|
|
||||||
_$GameSessionResultImpl _$$GameSessionResultImplFromJson(
|
_GameSessionResult _$GameSessionResultFromJson(Map<String, dynamic> json) =>
|
||||||
Map<String, dynamic> json) =>
|
_GameSessionResult(
|
||||||
_$GameSessionResultImpl(
|
|
||||||
testId: json['testId'] as String,
|
testId: json['testId'] as String,
|
||||||
questionResults: (json['questionResults'] as List<dynamic>)
|
questionResults: (json['questionResults'] as List<dynamic>)
|
||||||
.map((e) => QuestionResult.fromJson(e as Map<String, dynamic>))
|
.map((e) => QuestionResult.fromJson(e as Map<String, dynamic>))
|
||||||
|
|
@ -258,8 +244,7 @@ _$GameSessionResultImpl _$$GameSessionResultImplFromJson(
|
||||||
completedAt: DateTime.parse(json['completedAt'] as String),
|
completedAt: DateTime.parse(json['completedAt'] as String),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$GameSessionResultImplToJson(
|
Map<String, dynamic> _$GameSessionResultToJson(_GameSessionResult instance) =>
|
||||||
_$GameSessionResultImpl instance) =>
|
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'testId': instance.testId,
|
'testId': instance.testId,
|
||||||
'questionResults': instance.questionResults,
|
'questionResults': instance.questionResults,
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ class CardFlipperService {
|
||||||
/// Calculate study progress for a pack
|
/// Calculate study progress for a pack
|
||||||
StudyProgress calculateStudyProgress({
|
StudyProgress calculateStudyProgress({
|
||||||
required List<GameCardDto> cards,
|
required List<GameCardDto> cards,
|
||||||
required Map<int, bool> flippedCards,
|
required Map<String, bool> flippedCards,
|
||||||
required Map<int, bool> learnedCards,
|
required Map<String, bool> learnedCards,
|
||||||
}) {
|
}) {
|
||||||
log('Calculating study progress for ${cards.length} cards', name: 'CardFlipperService');
|
log('Calculating study progress for ${cards.length} cards', name: 'CardFlipperService');
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ class CardStudyStats {
|
||||||
required this.lastStudied,
|
required this.lastStudied,
|
||||||
});
|
});
|
||||||
|
|
||||||
final int cardId;
|
final String cardId;
|
||||||
final bool isFlipped;
|
final bool isFlipped;
|
||||||
final bool isLearned;
|
final bool isLearned;
|
||||||
final int viewCount;
|
final int viewCount;
|
||||||
|
|
|
||||||
|
|
@ -948,7 +948,7 @@ class HttpRepositoryV2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get voices metadata for a specific card
|
/// 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 {
|
try {
|
||||||
final response = await _dio.get<Map<String, dynamic>>(
|
final response = await _dio.get<Map<String, dynamic>>(
|
||||||
ApiConfigV2.packCardVoices(packId, cardId),
|
ApiConfigV2.packCardVoices(packId, cardId),
|
||||||
|
|
|
||||||
|
|
@ -63,21 +63,21 @@ class PackProgressService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mark a card as learned in a pack
|
/// 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 {
|
try {
|
||||||
log('Marking card as learned: $packId/$cardId', name: 'PackProgressService');
|
log('Marking card as learned: $packId/$cardId', name: 'PackProgressService');
|
||||||
|
|
||||||
// Get current learned cards for this pack
|
// Get current learned cards for this pack
|
||||||
final learnedCardsKey = '${_progressKey}_cards_$packId';
|
final learnedCardsKey = '${_progressKey}_cards_$packId';
|
||||||
final learnedCardsList = _sharedPreferences.getStringList(learnedCardsKey) ?? [];
|
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
|
// Add the card if not already learned
|
||||||
if (!learnedCards.contains(cardId)) {
|
if (!learnedCards.contains(cardId)) {
|
||||||
learnedCards.add(cardId);
|
learnedCards.add(cardId);
|
||||||
await _sharedPreferences.setStringList(
|
await _sharedPreferences.setStringList(
|
||||||
learnedCardsKey,
|
learnedCardsKey,
|
||||||
learnedCards.map((e) => e.toString()).toList(),
|
learnedCards.toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update progress count
|
// Update progress count
|
||||||
|
|
@ -94,11 +94,11 @@ class PackProgressService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if a card is learned
|
/// Check if a card is learned
|
||||||
bool isCardLearned(String packId, int cardId) {
|
bool isCardLearned(String packId, String cardId) {
|
||||||
try {
|
try {
|
||||||
final learnedCardsKey = '${_progressKey}_cards_$packId';
|
final learnedCardsKey = '${_progressKey}_cards_$packId';
|
||||||
final learnedCardsList = _sharedPreferences.getStringList(learnedCardsKey) ?? [];
|
final learnedCardsList = _sharedPreferences.getStringList(learnedCardsKey) ?? [];
|
||||||
final learnedCards = learnedCardsList.map((e) => int.tryParse(e)).whereType<int>().toSet();
|
final learnedCards = learnedCardsList.toSet();
|
||||||
return learnedCards.contains(cardId);
|
return learnedCards.contains(cardId);
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
log(
|
log(
|
||||||
|
|
@ -112,11 +112,11 @@ class PackProgressService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get all learned cards for a pack
|
/// Get all learned cards for a pack
|
||||||
Set<int> getLearnedCards(String packId) {
|
Set<String> getLearnedCards(String packId) {
|
||||||
try {
|
try {
|
||||||
final learnedCardsKey = '${_progressKey}_cards_$packId';
|
final learnedCardsKey = '${_progressKey}_cards_$packId';
|
||||||
final learnedCardsList = _sharedPreferences.getStringList(learnedCardsKey) ?? [];
|
final learnedCardsList = _sharedPreferences.getStringList(learnedCardsKey) ?? [];
|
||||||
return learnedCardsList.map((e) => int.tryParse(e)).whereType<int>().toSet();
|
return learnedCardsList.toSet();
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
log(
|
log(
|
||||||
'Error getting learned cards',
|
'Error getting learned cards',
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -13,7 +13,7 @@ class CardFlipperState with _$CardFlipperState {
|
||||||
const factory CardFlipperState.loaded({
|
const factory CardFlipperState.loaded({
|
||||||
required List<GameCardDto> cards,
|
required List<GameCardDto> cards,
|
||||||
required int currentIndex,
|
required int currentIndex,
|
||||||
required Map<int, bool> flippedCards,
|
required Map<String, bool> flippedCards,
|
||||||
required bool isShuffled,
|
required bool isShuffled,
|
||||||
}) = _Loaded;
|
}) = _Loaded;
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +94,7 @@ class CardFlipperStateManager extends StateManager<CardFlipperState> {
|
||||||
final isFlipped =
|
final isFlipped =
|
||||||
currentState.flippedCards[currentCardId] ?? false;
|
currentState.flippedCards[currentCardId] ?? false;
|
||||||
final updatedFlippedCards =
|
final updatedFlippedCards =
|
||||||
Map<int, bool>.from(currentState.flippedCards);
|
Map<String, bool>.from(currentState.flippedCards);
|
||||||
updatedFlippedCards[currentCardId] = !isFlipped;
|
updatedFlippedCards[currentCardId] = !isFlipped;
|
||||||
|
|
||||||
log(
|
log(
|
||||||
|
|
@ -105,7 +105,7 @@ class CardFlipperStateManager extends StateManager<CardFlipperState> {
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Toggle flip state of specific card
|
/// 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;
|
final currentState = state;
|
||||||
if (currentState is! _Loaded) {
|
if (currentState is! _Loaded) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -113,7 +113,7 @@ class CardFlipperStateManager extends StateManager<CardFlipperState> {
|
||||||
|
|
||||||
final isFlipped = currentState.flippedCards[cardId] ?? false;
|
final isFlipped = currentState.flippedCards[cardId] ?? false;
|
||||||
final updatedFlippedCards =
|
final updatedFlippedCards =
|
||||||
Map<int, bool>.from(currentState.flippedCards);
|
Map<String, bool>.from(currentState.flippedCards);
|
||||||
updatedFlippedCards[cardId] = !isFlipped;
|
updatedFlippedCards[cardId] = !isFlipped;
|
||||||
|
|
||||||
log(
|
log(
|
||||||
|
|
@ -185,7 +185,7 @@ class CardFlipperStateManager extends StateManager<CardFlipperState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if specific card is flipped
|
/// Check if specific card is flipped
|
||||||
bool isCardFlipped(int cardId) {
|
bool isCardFlipped(String cardId) {
|
||||||
final currentState = state;
|
final currentState = state;
|
||||||
if (currentState is! _Loaded) return false;
|
if (currentState is! _Loaded) return false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// coverage:ignore-file
|
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
// ignore_for_file: type=lint
|
// 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
|
// 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
|
// FreezedGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
T _$identity<T>(T value) => value;
|
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
|
/// @nodoc
|
||||||
mixin _$CardFlipperState {
|
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,
|
@override
|
||||||
}) =>
|
bool operator ==(Object other) {
|
||||||
throw _privateConstructorUsedError;
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is CardFlipperState);
|
||||||
@optionalTypeArgs
|
}
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function()? initial,
|
|
||||||
TResult? Function(List<GameCardDto> cards, int currentIndex,
|
@override
|
||||||
Map<int, bool> flippedCards, bool isShuffled)?
|
int get hashCode => runtimeType.hashCode;
|
||||||
loaded,
|
|
||||||
}) =>
|
@override
|
||||||
throw _privateConstructorUsedError;
|
String toString() {
|
||||||
@optionalTypeArgs
|
return 'CardFlipperState()';
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class $CardFlipperStateCopyWith<$Res> {
|
class $CardFlipperStateCopyWith<$Res> {
|
||||||
factory $CardFlipperStateCopyWith(
|
$CardFlipperStateCopyWith(CardFlipperState _, $Res Function(CardFlipperState) __);
|
||||||
CardFlipperState value, $Res Function(CardFlipperState) then) =
|
|
||||||
_$CardFlipperStateCopyWithImpl<$Res, CardFlipperState>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$CardFlipperStateCopyWithImpl<$Res, $Val extends CardFlipperState>
|
|
||||||
implements $CardFlipperStateCopyWith<$Res> {
|
|
||||||
_$CardFlipperStateCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
/// Adds pattern-matching-related methods to [CardFlipperState].
|
||||||
final $Val _value;
|
extension CardFlipperStatePatterns on CardFlipperState {
|
||||||
// ignore: unused_field
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
final $Res Function($Val) _then;
|
///
|
||||||
|
/// 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
|
/// @nodoc
|
||||||
|
|
||||||
class _$InitialImpl implements _Initial {
|
|
||||||
const _$InitialImpl();
|
|
||||||
|
|
||||||
@override
|
class _Initial implements CardFlipperState {
|
||||||
String toString() {
|
const _Initial();
|
||||||
return 'CardFlipperState.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
|
@override
|
||||||
@optionalTypeArgs
|
bool operator ==(Object other) {
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Initial);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
/// @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;
|
class _Loaded implements CardFlipperState {
|
||||||
@override
|
const _Loaded({required final List<GameCardDto> cards, required this.currentIndex, required final Map<String, bool> flippedCards, required this.isShuffled}): _cards = cards,_flippedCards = flippedCards;
|
||||||
List<GameCardDto> get cards {
|
|
||||||
if (_cards is EqualUnmodifiableListView) return _cards;
|
|
||||||
// ignore: implicit_dynamic_type
|
|
||||||
return EqualUnmodifiableListView(_cards);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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 List<GameCardDto> _cards;
|
||||||
final bool isShuffled;
|
List<GameCardDto> get cards {
|
||||||
|
if (_cards is EqualUnmodifiableListView) return _cards;
|
||||||
@override
|
// ignore: implicit_dynamic_type
|
||||||
String toString() {
|
return EqualUnmodifiableListView(_cards);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _Loaded implements CardFlipperState {
|
final int currentIndex;
|
||||||
const factory _Loaded(
|
final Map<String, bool> _flippedCards;
|
||||||
{required final List<GameCardDto> cards,
|
Map<String, bool> get flippedCards {
|
||||||
required final int currentIndex,
|
if (_flippedCards is EqualUnmodifiableMapView) return _flippedCards;
|
||||||
required final Map<int, bool> flippedCards,
|
// ignore: implicit_dynamic_type
|
||||||
required final bool isShuffled}) = _$LoadedImpl;
|
return EqualUnmodifiableMapView(_flippedCards);
|
||||||
|
|
||||||
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 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
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ part 'favorites_state_manager.freezed.dart';
|
||||||
class FavoritesState with _$FavoritesState {
|
class FavoritesState with _$FavoritesState {
|
||||||
const factory FavoritesState.initial() = _Initial;
|
const factory FavoritesState.initial() = _Initial;
|
||||||
const factory FavoritesState.loaded({
|
const factory FavoritesState.loaded({
|
||||||
required Set<int> favorites,
|
required Set<String> favorites,
|
||||||
}) = _Loaded;
|
}) = _Loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -30,11 +30,8 @@ class FavoritesStateManager extends StateManager<FavoritesState> {
|
||||||
log('Loading favorites', name: 'FavoritesStateManager');
|
log('Loading favorites', name: 'FavoritesStateManager');
|
||||||
try {
|
try {
|
||||||
final favoritesList = _sharedPreferences.getStringList(_favoritesKey) ?? [];
|
final favoritesList = _sharedPreferences.getStringList(_favoritesKey) ?? [];
|
||||||
final favorites = favoritesList
|
final favorites = favoritesList.toSet();
|
||||||
.map((e) => int.tryParse(e))
|
emit(FavoritesState.loaded(favorites: favorites));
|
||||||
.whereType<int>()
|
|
||||||
.toSet();
|
|
||||||
emit(FavoritesState.loaded(favorites: favorites));
|
|
||||||
log('Loaded ${favorites.length} favorites', name: 'FavoritesStateManager');
|
log('Loaded ${favorites.length} favorites', name: 'FavoritesStateManager');
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
log(
|
log(
|
||||||
|
|
@ -49,7 +46,7 @@ class FavoritesStateManager extends StateManager<FavoritesState> {
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Toggle favorite status for a card
|
/// 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');
|
log('Toggling favorite for card $cardId', name: 'FavoritesStateManager');
|
||||||
final currentState = state;
|
final currentState = state;
|
||||||
|
|
||||||
|
|
@ -59,7 +56,7 @@ class FavoritesStateManager extends StateManager<FavoritesState> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<int> updatedFavorites;
|
final Set<String> updatedFavorites;
|
||||||
if (currentState.favorites.contains(cardId)) {
|
if (currentState.favorites.contains(cardId)) {
|
||||||
updatedFavorites = Set.from(currentState.favorites)..remove(cardId);
|
updatedFavorites = Set.from(currentState.favorites)..remove(cardId);
|
||||||
log('Removed card $cardId from favorites', name: 'FavoritesStateManager');
|
log('Removed card $cardId from favorites', name: 'FavoritesStateManager');
|
||||||
|
|
@ -70,7 +67,7 @@ class FavoritesStateManager extends StateManager<FavoritesState> {
|
||||||
|
|
||||||
// Save to SharedPreferences
|
// Save to SharedPreferences
|
||||||
try {
|
try {
|
||||||
final favoritesList = updatedFavorites.map((e) => e.toString()).toList();
|
final favoritesList = updatedFavorites.toList();
|
||||||
await _sharedPreferences.setStringList(_favoritesKey, favoritesList);
|
await _sharedPreferences.setStringList(_favoritesKey, favoritesList);
|
||||||
emit(FavoritesState.loaded(favorites: updatedFavorites));
|
emit(FavoritesState.loaded(favorites: updatedFavorites));
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
|
|
@ -85,7 +82,7 @@ class FavoritesStateManager extends StateManager<FavoritesState> {
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Check if a card is favorite
|
/// Check if a card is favorite
|
||||||
bool isFavorite(int cardId) {
|
bool isFavorite(String cardId) {
|
||||||
final currentState = state;
|
final currentState = state;
|
||||||
if (currentState is _Loaded) {
|
if (currentState is _Loaded) {
|
||||||
return currentState.favorites.contains(cardId);
|
return currentState.favorites.contains(cardId);
|
||||||
|
|
@ -94,7 +91,7 @@ class FavoritesStateManager extends StateManager<FavoritesState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get all favorite IDs
|
/// Get all favorite IDs
|
||||||
Set<int> get favorites {
|
Set<String> get favorites {
|
||||||
final currentState = state;
|
final currentState = state;
|
||||||
if (currentState is _Loaded) {
|
if (currentState is _Loaded) {
|
||||||
return currentState.favorites;
|
return currentState.favorites;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// coverage:ignore-file
|
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
// ignore_for_file: type=lint
|
// 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
|
// 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
|
// FreezedGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
T _$identity<T>(T value) => value;
|
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
|
/// @nodoc
|
||||||
mixin _$FavoritesState {
|
mixin _$FavoritesState {
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function() initial,
|
|
||||||
required TResult Function(Set<int> favorites) loaded,
|
|
||||||
}) =>
|
|
||||||
throw _privateConstructorUsedError;
|
@override
|
||||||
@optionalTypeArgs
|
bool operator ==(Object other) {
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is FavoritesState);
|
||||||
TResult? Function()? initial,
|
}
|
||||||
TResult? Function(Set<int> favorites)? loaded,
|
|
||||||
}) =>
|
|
||||||
throw _privateConstructorUsedError;
|
@override
|
||||||
@optionalTypeArgs
|
int get hashCode => runtimeType.hashCode;
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
|
||||||
TResult Function()? initial,
|
@override
|
||||||
TResult Function(Set<int> favorites)? loaded,
|
String toString() {
|
||||||
required TResult orElse(),
|
return 'FavoritesState()';
|
||||||
}) =>
|
}
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class $FavoritesStateCopyWith<$Res> {
|
class $FavoritesStateCopyWith<$Res> {
|
||||||
factory $FavoritesStateCopyWith(
|
$FavoritesStateCopyWith(FavoritesState _, $Res Function(FavoritesState) __);
|
||||||
FavoritesState value, $Res Function(FavoritesState) then) =
|
|
||||||
_$FavoritesStateCopyWithImpl<$Res, FavoritesState>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$FavoritesStateCopyWithImpl<$Res, $Val extends FavoritesState>
|
|
||||||
implements $FavoritesStateCopyWith<$Res> {
|
|
||||||
_$FavoritesStateCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
/// Adds pattern-matching-related methods to [FavoritesState].
|
||||||
final $Val _value;
|
extension FavoritesStatePatterns on FavoritesState {
|
||||||
// ignore: unused_field
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
final $Res Function($Val) _then;
|
///
|
||||||
|
/// 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
|
/// @nodoc
|
||||||
|
|
||||||
class _$InitialImpl implements _Initial {
|
|
||||||
const _$InitialImpl();
|
|
||||||
|
|
||||||
@override
|
class _Initial implements FavoritesState {
|
||||||
String toString() {
|
const _Initial();
|
||||||
return 'FavoritesState.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
|
@override
|
||||||
@optionalTypeArgs
|
bool operator ==(Object other) {
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Initial);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
/// @nodoc
|
||||||
|
|
||||||
class _$LoadedImpl implements _Loaded {
|
|
||||||
const _$LoadedImpl({required final Set<int> favorites})
|
|
||||||
: _favorites = favorites;
|
|
||||||
|
|
||||||
final Set<int> _favorites;
|
class _Loaded implements FavoritesState {
|
||||||
@override
|
const _Loaded({required final Set<String> favorites}): _favorites = favorites;
|
||||||
Set<int> get favorites {
|
|
||||||
if (_favorites is EqualUnmodifiableSetView) return _favorites;
|
|
||||||
// ignore: implicit_dynamic_type
|
|
||||||
return EqualUnmodifiableSetView(_favorites);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'FavoritesState.loaded(favorites: $favorites)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
final Set<String> _favorites;
|
||||||
bool operator ==(Object other) {
|
Set<String> get favorites {
|
||||||
return identical(this, other) ||
|
if (_favorites is EqualUnmodifiableSetView) return _favorites;
|
||||||
(other.runtimeType == runtimeType &&
|
// ignore: implicit_dynamic_type
|
||||||
other is _$LoadedImpl &&
|
return EqualUnmodifiableSetView(_favorites);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _Loaded implements FavoritesState {
|
|
||||||
const factory _Loaded({required final Set<int> favorites}) = _$LoadedImpl;
|
|
||||||
|
|
||||||
Set<int> get favorites;
|
/// Create a copy of FavoritesState
|
||||||
@JsonKey(ignore: true)
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
throw _privateConstructorUsedError;
|
@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
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// coverage:ignore-file
|
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
// ignore_for_file: type=lint
|
// 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
|
// 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
|
// FreezedGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
T _$identity<T>(T value) => value;
|
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
|
/// @nodoc
|
||||||
mixin _$GamesState {
|
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,
|
|
||||||
}) =>
|
@override
|
||||||
throw _privateConstructorUsedError;
|
bool operator ==(Object other) {
|
||||||
@optionalTypeArgs
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is GamesState);
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
}
|
||||||
TResult? Function()? loading,
|
|
||||||
TResult? Function(List<GameDto> games, String searchQuery)? loaded,
|
|
||||||
TResult? Function(String message)? error,
|
@override
|
||||||
}) =>
|
int get hashCode => runtimeType.hashCode;
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
@override
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
String toString() {
|
||||||
TResult Function()? loading,
|
return 'GamesState()';
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class $GamesStateCopyWith<$Res> {
|
class $GamesStateCopyWith<$Res> {
|
||||||
factory $GamesStateCopyWith(
|
$GamesStateCopyWith(GamesState _, $Res Function(GamesState) __);
|
||||||
GamesState value, $Res Function(GamesState) then) =
|
|
||||||
_$GamesStateCopyWithImpl<$Res, GamesState>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$GamesStateCopyWithImpl<$Res, $Val extends GamesState>
|
|
||||||
implements $GamesStateCopyWith<$Res> {
|
|
||||||
_$GamesStateCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
/// Adds pattern-matching-related methods to [GamesState].
|
||||||
final $Val _value;
|
extension GamesStatePatterns on GamesState {
|
||||||
// ignore: unused_field
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
final $Res Function($Val) _then;
|
///
|
||||||
|
/// 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
|
/// @nodoc
|
||||||
|
|
||||||
class _$LoadingImpl implements _Loading {
|
|
||||||
const _$LoadingImpl();
|
|
||||||
|
|
||||||
@override
|
class _Loading implements GamesState {
|
||||||
String toString() {
|
const _Loading();
|
||||||
return 'GamesState.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
|
@override
|
||||||
@optionalTypeArgs
|
bool operator ==(Object other) {
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loading);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
/// @nodoc
|
||||||
abstract class _$$LoadedImplCopyWith<$Res> {
|
abstract mixin class _$LoadedCopyWith<$Res> implements $GamesStateCopyWith<$Res> {
|
||||||
factory _$$LoadedImplCopyWith(
|
factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl;
|
||||||
_$LoadedImpl value, $Res Function(_$LoadedImpl) then) =
|
@useResult
|
||||||
__$$LoadedImplCopyWithImpl<$Res>;
|
$Res call({
|
||||||
@useResult
|
List<GameDto> games, String searchQuery
|
||||||
$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
|
/// @nodoc
|
||||||
|
|
||||||
class _$LoadedImpl implements _Loaded {
|
|
||||||
const _$LoadedImpl(
|
|
||||||
{required final List<GameDto> games, this.searchQuery = ''})
|
|
||||||
: _games = games;
|
|
||||||
|
|
||||||
final List<GameDto> _games;
|
class _Error implements GamesState {
|
||||||
@override
|
const _Error(this.message);
|
||||||
List<GameDto> get games {
|
|
||||||
if (_games is EqualUnmodifiableListView) return _games;
|
|
||||||
// ignore: implicit_dynamic_type
|
|
||||||
return EqualUnmodifiableListView(_games);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey()
|
|
||||||
final String searchQuery;
|
|
||||||
|
|
||||||
@override
|
final String message;
|
||||||
String toString() {
|
|
||||||
return 'GamesState.loaded(games: $games, searchQuery: $searchQuery)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
/// Create a copy of GamesState
|
||||||
bool operator ==(Object other) {
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
return identical(this, other) ||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
(other.runtimeType == runtimeType &&
|
@pragma('vm:prefer-inline')
|
||||||
other is _$LoadedImpl &&
|
_$ErrorCopyWith<_Error> get copyWith => __$ErrorCopyWithImpl<_Error>(this, _$identity);
|
||||||
const DeepCollectionEquality().equals(other._games, _games) &&
|
|
||||||
(identical(other.searchQuery, searchQuery) ||
|
|
||||||
other.searchQuery == searchQuery));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
runtimeType, const DeepCollectionEquality().hash(_games), searchQuery);
|
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
|
|
||||||
__$$LoadedImplCopyWithImpl<_$LoadedImpl>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
bool operator ==(Object other) {
|
||||||
TResult when<TResult extends Object?>({
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Error&&(identical(other.message, message) || other.message == message));
|
||||||
required TResult Function() loading,
|
}
|
||||||
required TResult Function(List<GameDto> games, String searchQuery) loaded,
|
|
||||||
required TResult Function(String message) error,
|
|
||||||
}) {
|
@override
|
||||||
return loaded(games, searchQuery);
|
int get hashCode => Object.hash(runtimeType,message);
|
||||||
}
|
|
||||||
|
@override
|
||||||
@override
|
String toString() {
|
||||||
@optionalTypeArgs
|
return 'GamesState.error(message: $message)';
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
/// @nodoc
|
||||||
abstract class _$$ErrorImplCopyWith<$Res> {
|
abstract mixin class _$ErrorCopyWith<$Res> implements $GamesStateCopyWith<$Res> {
|
||||||
factory _$$ErrorImplCopyWith(
|
factory _$ErrorCopyWith(_Error value, $Res Function(_Error) _then) = __$ErrorCopyWithImpl;
|
||||||
_$ErrorImpl value, $Res Function(_$ErrorImpl) then) =
|
@useResult
|
||||||
__$$ErrorImplCopyWithImpl<$Res>;
|
$Res call({
|
||||||
@useResult
|
String message
|
||||||
$Res call({String message});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
class __$$ErrorImplCopyWithImpl<$Res>
|
class __$ErrorCopyWithImpl<$Res>
|
||||||
extends _$GamesStateCopyWithImpl<$Res, _$ErrorImpl>
|
implements _$ErrorCopyWith<$Res> {
|
||||||
implements _$$ErrorImplCopyWith<$Res> {
|
__$ErrorCopyWithImpl(this._self, this._then);
|
||||||
__$$ErrorImplCopyWithImpl(
|
|
||||||
_$ErrorImpl _value, $Res Function(_$ErrorImpl) _then)
|
|
||||||
: super(_value, _then);
|
|
||||||
|
|
||||||
@pragma('vm:prefer-inline')
|
final _Error _self;
|
||||||
@override
|
final $Res Function(_Error) _then;
|
||||||
$Res call({
|
|
||||||
Object? message = null,
|
/// Create a copy of GamesState
|
||||||
}) {
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
return _then(_$ErrorImpl(
|
@pragma('vm:prefer-inline') $Res call({Object? message = null,}) {
|
||||||
null == message
|
return _then(_Error(
|
||||||
? _value.message
|
null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
: message // ignore: cast_nullable_to_non_nullable
|
as String,
|
||||||
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 {
|
// dart format on
|
||||||
const factory _Error(final String message) = _$ErrorImpl;
|
|
||||||
|
|
||||||
String get message;
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// coverage:ignore-file
|
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
// ignore_for_file: type=lint
|
// 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
|
// 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
|
// FreezedGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
T _$identity<T>(T value) => value;
|
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
|
/// @nodoc
|
||||||
mixin _$PacksState {
|
mixin _$PacksState {
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function() loading,
|
|
||||||
required TResult Function(
|
|
||||||
List<CardPackPreviewDto> packs, String searchQuery)
|
|
||||||
loaded,
|
@override
|
||||||
required TResult Function(String message) error,
|
bool operator ==(Object other) {
|
||||||
}) =>
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is PacksState);
|
||||||
throw _privateConstructorUsedError;
|
}
|
||||||
@optionalTypeArgs
|
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
|
||||||
TResult? Function()? loading,
|
@override
|
||||||
TResult? Function(List<CardPackPreviewDto> packs, String searchQuery)?
|
int get hashCode => runtimeType.hashCode;
|
||||||
loaded,
|
|
||||||
TResult? Function(String message)? error,
|
@override
|
||||||
}) =>
|
String toString() {
|
||||||
throw _privateConstructorUsedError;
|
return 'PacksState()';
|
||||||
@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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class $PacksStateCopyWith<$Res> {
|
class $PacksStateCopyWith<$Res> {
|
||||||
factory $PacksStateCopyWith(
|
$PacksStateCopyWith(PacksState _, $Res Function(PacksState) __);
|
||||||
PacksState value, $Res Function(PacksState) then) =
|
|
||||||
_$PacksStateCopyWithImpl<$Res, PacksState>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$PacksStateCopyWithImpl<$Res, $Val extends PacksState>
|
|
||||||
implements $PacksStateCopyWith<$Res> {
|
|
||||||
_$PacksStateCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
/// Adds pattern-matching-related methods to [PacksState].
|
||||||
final $Val _value;
|
extension PacksStatePatterns on PacksState {
|
||||||
// ignore: unused_field
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
final $Res Function($Val) _then;
|
///
|
||||||
|
/// 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
|
/// @nodoc
|
||||||
|
|
||||||
class _$LoadingImpl implements _Loading {
|
|
||||||
const _$LoadingImpl();
|
|
||||||
|
|
||||||
@override
|
class _Loading implements PacksState {
|
||||||
String toString() {
|
const _Loading();
|
||||||
return 'PacksState.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
|
@override
|
||||||
@optionalTypeArgs
|
bool operator ==(Object other) {
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loading);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
/// @nodoc
|
||||||
abstract class _$$LoadedImplCopyWith<$Res> {
|
abstract mixin class _$LoadedCopyWith<$Res> implements $PacksStateCopyWith<$Res> {
|
||||||
factory _$$LoadedImplCopyWith(
|
factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl;
|
||||||
_$LoadedImpl value, $Res Function(_$LoadedImpl) then) =
|
@useResult
|
||||||
__$$LoadedImplCopyWithImpl<$Res>;
|
$Res call({
|
||||||
@useResult
|
List<CardPackPreviewDto> packs, String searchQuery
|
||||||
$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
|
/// @nodoc
|
||||||
|
|
||||||
class _$LoadedImpl implements _Loaded {
|
|
||||||
const _$LoadedImpl(
|
|
||||||
{required final List<CardPackPreviewDto> packs, this.searchQuery = ''})
|
|
||||||
: _packs = packs;
|
|
||||||
|
|
||||||
final List<CardPackPreviewDto> _packs;
|
class _Error implements PacksState {
|
||||||
@override
|
const _Error(this.message);
|
||||||
List<CardPackPreviewDto> get packs {
|
|
||||||
if (_packs is EqualUnmodifiableListView) return _packs;
|
|
||||||
// ignore: implicit_dynamic_type
|
|
||||||
return EqualUnmodifiableListView(_packs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
@JsonKey()
|
|
||||||
final String searchQuery;
|
|
||||||
|
|
||||||
@override
|
final String message;
|
||||||
String toString() {
|
|
||||||
return 'PacksState.loaded(packs: $packs, searchQuery: $searchQuery)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
/// Create a copy of PacksState
|
||||||
bool operator ==(Object other) {
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
return identical(this, other) ||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
(other.runtimeType == runtimeType &&
|
@pragma('vm:prefer-inline')
|
||||||
other is _$LoadedImpl &&
|
_$ErrorCopyWith<_Error> get copyWith => __$ErrorCopyWithImpl<_Error>(this, _$identity);
|
||||||
const DeepCollectionEquality().equals(other._packs, _packs) &&
|
|
||||||
(identical(other.searchQuery, searchQuery) ||
|
|
||||||
other.searchQuery == searchQuery));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(
|
|
||||||
runtimeType, const DeepCollectionEquality().hash(_packs), searchQuery);
|
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
|
|
||||||
__$$LoadedImplCopyWithImpl<_$LoadedImpl>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
bool operator ==(Object other) {
|
||||||
TResult when<TResult extends Object?>({
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Error&&(identical(other.message, message) || other.message == message));
|
||||||
required TResult Function() loading,
|
}
|
||||||
required TResult Function(
|
|
||||||
List<CardPackPreviewDto> packs, String searchQuery)
|
|
||||||
loaded,
|
@override
|
||||||
required TResult Function(String message) error,
|
int get hashCode => Object.hash(runtimeType,message);
|
||||||
}) {
|
|
||||||
return loaded(packs, searchQuery);
|
@override
|
||||||
}
|
String toString() {
|
||||||
|
return 'PacksState.error(message: $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 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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
/// @nodoc
|
||||||
abstract class _$$ErrorImplCopyWith<$Res> {
|
abstract mixin class _$ErrorCopyWith<$Res> implements $PacksStateCopyWith<$Res> {
|
||||||
factory _$$ErrorImplCopyWith(
|
factory _$ErrorCopyWith(_Error value, $Res Function(_Error) _then) = __$ErrorCopyWithImpl;
|
||||||
_$ErrorImpl value, $Res Function(_$ErrorImpl) then) =
|
@useResult
|
||||||
__$$ErrorImplCopyWithImpl<$Res>;
|
$Res call({
|
||||||
@useResult
|
String message
|
||||||
$Res call({String message});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
class __$$ErrorImplCopyWithImpl<$Res>
|
class __$ErrorCopyWithImpl<$Res>
|
||||||
extends _$PacksStateCopyWithImpl<$Res, _$ErrorImpl>
|
implements _$ErrorCopyWith<$Res> {
|
||||||
implements _$$ErrorImplCopyWith<$Res> {
|
__$ErrorCopyWithImpl(this._self, this._then);
|
||||||
__$$ErrorImplCopyWithImpl(
|
|
||||||
_$ErrorImpl _value, $Res Function(_$ErrorImpl) _then)
|
|
||||||
: super(_value, _then);
|
|
||||||
|
|
||||||
@pragma('vm:prefer-inline')
|
final _Error _self;
|
||||||
@override
|
final $Res Function(_Error) _then;
|
||||||
$Res call({
|
|
||||||
Object? message = null,
|
/// Create a copy of PacksState
|
||||||
}) {
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
return _then(_$ErrorImpl(
|
@pragma('vm:prefer-inline') $Res call({Object? message = null,}) {
|
||||||
null == message
|
return _then(_Error(
|
||||||
? _value.message
|
null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
: message // ignore: cast_nullable_to_non_nullable
|
as String,
|
||||||
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 {
|
// dart format on
|
||||||
const factory _Error(final String message) = _$ErrorImpl;
|
|
||||||
|
|
||||||
String get message;
|
|
||||||
@JsonKey(ignore: true)
|
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,5 @@
|
||||||
// coverage:ignore-file
|
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
// ignore_for_file: type=lint
|
// 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
|
// 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
|
// FreezedGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
T _$identity<T>(T value) => value;
|
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
|
/// @nodoc
|
||||||
mixin _$UserState {
|
mixin _$UserState {
|
||||||
@optionalTypeArgs
|
|
||||||
TResult when<TResult extends Object?>({
|
|
||||||
required TResult Function() guest,
|
|
||||||
required TResult Function(UserDto user) authenticated,
|
|
||||||
required TResult Function() loading,
|
|
||||||
}) =>
|
@override
|
||||||
throw _privateConstructorUsedError;
|
bool operator ==(Object other) {
|
||||||
@optionalTypeArgs
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is UserState);
|
||||||
TResult? whenOrNull<TResult extends Object?>({
|
}
|
||||||
TResult? Function()? guest,
|
|
||||||
TResult? Function(UserDto user)? authenticated,
|
|
||||||
TResult? Function()? loading,
|
@override
|
||||||
}) =>
|
int get hashCode => runtimeType.hashCode;
|
||||||
throw _privateConstructorUsedError;
|
|
||||||
@optionalTypeArgs
|
@override
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
String toString() {
|
||||||
TResult Function()? guest,
|
return 'UserState()';
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class $UserStateCopyWith<$Res> {
|
class $UserStateCopyWith<$Res> {
|
||||||
factory $UserStateCopyWith(UserState value, $Res Function(UserState) then) =
|
$UserStateCopyWith(UserState _, $Res Function(UserState) __);
|
||||||
_$UserStateCopyWithImpl<$Res, UserState>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
class _$UserStateCopyWithImpl<$Res, $Val extends UserState>
|
|
||||||
implements $UserStateCopyWith<$Res> {
|
|
||||||
_$UserStateCopyWithImpl(this._value, this._then);
|
|
||||||
|
|
||||||
// ignore: unused_field
|
/// Adds pattern-matching-related methods to [UserState].
|
||||||
final $Val _value;
|
extension UserStatePatterns on UserState {
|
||||||
// ignore: unused_field
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
final $Res Function($Val) _then;
|
///
|
||||||
|
/// 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
|
/// @nodoc
|
||||||
|
|
||||||
class _$GuestImpl implements _Guest {
|
|
||||||
const _$GuestImpl();
|
|
||||||
|
|
||||||
@override
|
class _Guest implements UserState {
|
||||||
String toString() {
|
const _Guest();
|
||||||
return 'UserState.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
|
@override
|
||||||
@optionalTypeArgs
|
bool operator ==(Object other) {
|
||||||
TResult? mapOrNull<TResult extends Object?>({
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Guest);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
/// @nodoc
|
||||||
abstract class _$$AuthenticatedImplCopyWith<$Res> {
|
abstract mixin class _$AuthenticatedCopyWith<$Res> implements $UserStateCopyWith<$Res> {
|
||||||
factory _$$AuthenticatedImplCopyWith(
|
factory _$AuthenticatedCopyWith(_Authenticated value, $Res Function(_Authenticated) _then) = __$AuthenticatedCopyWithImpl;
|
||||||
_$AuthenticatedImpl value, $Res Function(_$AuthenticatedImpl) then) =
|
@useResult
|
||||||
__$$AuthenticatedImplCopyWithImpl<$Res>;
|
$Res call({
|
||||||
@useResult
|
UserDto user
|
||||||
$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
|
/// @nodoc
|
||||||
|
|
||||||
class _$AuthenticatedImpl implements _Authenticated {
|
|
||||||
const _$AuthenticatedImpl({required this.user});
|
|
||||||
|
|
||||||
@override
|
class _Loading implements UserState {
|
||||||
final UserDto user;
|
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
|
@override
|
||||||
@optionalTypeArgs
|
bool operator ==(Object other) {
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loading);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _Authenticated implements UserState {
|
|
||||||
const factory _Authenticated({required final UserDto user}) =
|
|
||||||
_$AuthenticatedImpl;
|
|
||||||
|
|
||||||
UserDto get user;
|
@override
|
||||||
@JsonKey(ignore: true)
|
int get hashCode => runtimeType.hashCode;
|
||||||
_$$AuthenticatedImplCopyWith<_$AuthenticatedImpl> get copyWith =>
|
|
||||||
throw _privateConstructorUsedError;
|
@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
|
// dart format on
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
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_scope_flutter/yx_scope_flutter.dart';
|
||||||
import 'package:yx_state_flutter/yx_state_flutter.dart';
|
import 'package:yx_state_flutter/yx_state_flutter.dart';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mnemo_cards_common/mnemo_cards_common.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_scope_flutter/yx_scope_flutter.dart';
|
||||||
import 'package:yx_state_flutter/yx_state_flutter.dart';
|
import 'package:yx_state_flutter/yx_state_flutter.dart';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
|
||||||
List<GameCardDto> _shuffledCards = [];
|
List<GameCardDto> _shuffledCards = [];
|
||||||
int _shuffleAnimationKey = 0;
|
int _shuffleAnimationKey = 0;
|
||||||
double _shuffleAnimationTurns = 0;
|
double _shuffleAnimationTurns = 0;
|
||||||
Map<int, int> _previousCardIndexById = {};
|
Map<String, int> _previousCardIndexById = {};
|
||||||
int _lastAnimatedShuffleKey = 0;
|
int _lastAnimatedShuffleKey = 0;
|
||||||
bool _isNavigatingToPurchase = false;
|
bool _isNavigatingToPurchase = false;
|
||||||
|
|
||||||
|
|
@ -539,9 +539,9 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
|
||||||
|
|
||||||
final shouldAnimateMovement = _lastAnimatedShuffleKey != _shuffleAnimationKey;
|
final shouldAnimateMovement = _lastAnimatedShuffleKey != _shuffleAnimationKey;
|
||||||
final previousIndexById = shouldAnimateMovement
|
final previousIndexById = shouldAnimateMovement
|
||||||
? Map<int, int>.from(_previousCardIndexById)
|
? Map<String, int>.from(_previousCardIndexById)
|
||||||
: const <int, int>{};
|
: const <String, int>{};
|
||||||
final currentIndexById = <int, int>{
|
final currentIndexById = <String, int>{
|
||||||
for (var i = 0; i < displayCards.length; i++) displayCards[i].id: i,
|
for (var i = 0; i < displayCards.length; i++) displayCards[i].id: i,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -587,7 +587,7 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
|
||||||
List<GameCardDto> cards,
|
List<GameCardDto> cards,
|
||||||
Color packColor,
|
Color packColor,
|
||||||
bool animateMovement,
|
bool animateMovement,
|
||||||
Map<int, int> previousIndexById,
|
Map<String, int> previousIndexById,
|
||||||
) {
|
) {
|
||||||
const spacing = 8.0;
|
const spacing = 8.0;
|
||||||
const childAspectRatio = 0.8;
|
const childAspectRatio = 0.8;
|
||||||
|
|
@ -644,7 +644,7 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
|
||||||
List<GameCardDto> cards,
|
List<GameCardDto> cards,
|
||||||
Color packColor,
|
Color packColor,
|
||||||
bool animateMovement,
|
bool animateMovement,
|
||||||
Map<int, int> previousIndexById,
|
Map<String, int> previousIndexById,
|
||||||
) {
|
) {
|
||||||
const itemHeight = 100.0;
|
const itemHeight = 100.0;
|
||||||
const spacing = 8.0;
|
const spacing = 8.0;
|
||||||
|
|
@ -943,7 +943,7 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Marks a card as learned
|
/// Marks a card as learned
|
||||||
Future<void> _markCardLearned(int cardId) async {
|
Future<void> _markCardLearned(String cardId) async {
|
||||||
try {
|
try {
|
||||||
final appScope = ScopeProvider.of<AppScopeContainer>(
|
final appScope = ScopeProvider.of<AppScopeContainer>(
|
||||||
context,
|
context,
|
||||||
|
|
@ -1024,7 +1024,7 @@ class _PackDetailsPageState extends State<PackDetailsPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Проверяет, является ли карточка избранной
|
/// Проверяет, является ли карточка избранной
|
||||||
bool _isCardFavorite(int cardId) {
|
bool _isCardFavorite(String cardId) {
|
||||||
final appScope = ScopeProvider.of<AppScopeContainer>(
|
final appScope = ScopeProvider.of<AppScopeContainer>(
|
||||||
context,
|
context,
|
||||||
listen: false,
|
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>(
|
final appScope = ScopeProvider.of<AppScopeContainer>(
|
||||||
context,
|
context,
|
||||||
listen: false,
|
listen: false,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mnemo_cards_common/mnemo_cards_common.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/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_scope_flutter/yx_scope_flutter.dart';
|
||||||
import 'package:yx_state_flutter/yx_state_flutter.dart';
|
import 'package:yx_state_flutter/yx_state_flutter.dart';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class CardViewer extends StatefulWidget {
|
||||||
class _CardViewerState extends State<CardViewer> {
|
class _CardViewerState extends State<CardViewer> {
|
||||||
late PageController _pageController;
|
late PageController _pageController;
|
||||||
late int _currentIndex;
|
late int _currentIndex;
|
||||||
final Map<int, bool> _flippedCards = {};
|
final Map<String, bool> _flippedCards = {};
|
||||||
final FocusNode _focusNode = FocusNode();
|
final FocusNode _focusNode = FocusNode();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -62,11 +62,11 @@ class _CardViewerState extends State<CardViewer> {
|
||||||
super.dispose();
|
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(() {
|
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) {
|
Widget _buildCard(GameCardDto card, int index, Color packColor) {
|
||||||
final isFlipped = _isCardFlipped(index);
|
final isFlipped = _isCardFlipped(card.id);
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => _toggleCardFlip(index),
|
onTap: () => _toggleCardFlip(card.id),
|
||||||
child: AnimatedSwitcher(
|
child: AnimatedSwitcher(
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
transitionBuilder: (child, animation) {
|
transitionBuilder: (child, animation) {
|
||||||
|
|
@ -583,7 +583,7 @@ class CardVoiceControls extends StatefulWidget {
|
||||||
});
|
});
|
||||||
|
|
||||||
final String packId;
|
final String packId;
|
||||||
final int cardId;
|
final String cardId;
|
||||||
final Color accentColor;
|
final Color accentColor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -594,7 +594,7 @@ class _CardVoiceControlsState extends State<CardVoiceControls> {
|
||||||
late Future<List<VoiceDto>> _voicesFuture;
|
late Future<List<VoiceDto>> _voicesFuture;
|
||||||
final AudioPlayer _player = AudioPlayer();
|
final AudioPlayer _player = AudioPlayer();
|
||||||
bool _isPlaying = false;
|
bool _isPlaying = false;
|
||||||
int? _currentVoiceId;
|
String? _currentVoiceId;
|
||||||
String? _playError;
|
String? _playError;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ import 'package:flutter/material.dart';
|
||||||
/// Calculates the offset required to animate a card from its previous grid
|
/// Calculates the offset required to animate a card from its previous grid
|
||||||
/// position to the new one.
|
/// position to the new one.
|
||||||
Offset resolveGridMovementOffset({
|
Offset resolveGridMovementOffset({
|
||||||
required Map<int, int> previousIndexById,
|
required Map<String, int> previousIndexById,
|
||||||
required int cardId,
|
required String cardId,
|
||||||
required int currentIndex,
|
required int currentIndex,
|
||||||
required int crossAxisCount,
|
required int crossAxisCount,
|
||||||
required double itemWidth,
|
required double itemWidth,
|
||||||
|
|
@ -37,8 +37,8 @@ Offset resolveGridMovementOffset({
|
||||||
|
|
||||||
/// Calculates the offset required to animate a card in list mode.
|
/// Calculates the offset required to animate a card in list mode.
|
||||||
Offset resolveListMovementOffset({
|
Offset resolveListMovementOffset({
|
||||||
required Map<int, int> previousIndexById,
|
required Map<String, int> previousIndexById,
|
||||||
required int cardId,
|
required String cardId,
|
||||||
required int currentIndex,
|
required int currentIndex,
|
||||||
required double itemExtent,
|
required double itemExtent,
|
||||||
required double spacing,
|
required double spacing,
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: _fe_analyzer_shared
|
name: _fe_analyzer_shared
|
||||||
sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
|
sha256: c209688d9f5a5f26b2fb47a188131a6fb9e876ae9e47af3737c0b4f58a93470d
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "67.0.0"
|
version: "91.0.0"
|
||||||
_flutterfire_internals:
|
_flutterfire_internals:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -18,13 +18,13 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.59"
|
version: "1.3.59"
|
||||||
analyzer:
|
analyzer:
|
||||||
dependency: transitive
|
dependency: "direct overridden"
|
||||||
description:
|
description:
|
||||||
name: analyzer
|
name: analyzer
|
||||||
sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
|
sha256: f51c8499b35f9b26820cfe914828a6a98a94efd5cc78b37bb7d03debae3a1d08
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.4.1"
|
version: "8.4.1"
|
||||||
archive:
|
archive:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -140,18 +140,18 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build
|
name: build
|
||||||
sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0"
|
sha256: c1668065e9ba04752570ad7e038288559d1e2ca5c6d0131c0f5f55e39e777413
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.1"
|
version: "4.0.3"
|
||||||
build_config:
|
build_config:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build_config
|
name: build_config
|
||||||
sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33"
|
sha256: "4f64382b97504dc2fcdf487d5aae33418e08b4703fc21249e4db6d804a4d0187"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.2"
|
version: "1.2.0"
|
||||||
build_daemon:
|
build_daemon:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -160,30 +160,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.0"
|
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:
|
build_runner:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: build_runner
|
name: build_runner
|
||||||
sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d"
|
sha256: "110c56ef29b5eb367b4d17fc79375fa8c18a6cd7acd92c05bb3986c17a079057"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.13"
|
version: "2.10.4"
|
||||||
build_runner_core:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: build_runner_core
|
|
||||||
sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "7.3.2"
|
|
||||||
built_collection:
|
built_collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -300,18 +284,18 @@ packages:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: copy_with_extension
|
name: copy_with_extension
|
||||||
sha256: fbcf890b0c34aedf0894f91a11a579994b61b4e04080204656b582708b5b1125
|
sha256: bf9f6ca0b88cce32a92e7386ab0dfb179b57d080e4e94254d3f90122e8c354c8
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.4"
|
version: "11.0.0"
|
||||||
copy_with_extension_gen:
|
copy_with_extension_gen:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: copy_with_extension_gen
|
name: copy_with_extension_gen
|
||||||
sha256: "51cd11094096d40824c8da629ca7f16f3b7cea5fc44132b679617483d43346b0"
|
sha256: "4af72c664b7b4cb4c467c084602a1cb87aa0d5ba06d7a06038500e8398810ce1"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.4"
|
version: "11.0.0"
|
||||||
cross_file:
|
cross_file:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -340,10 +324,10 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: dart_style
|
name: dart_style
|
||||||
sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9"
|
sha256: a9c30492da18ff84efe2422ba2d319a89942d93e58eb0b73d32abe822ef54b7b
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.6"
|
version: "3.1.3"
|
||||||
dbus:
|
dbus:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -651,26 +635,18 @@ packages:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: freezed
|
name: freezed
|
||||||
sha256: a434911f643466d78462625df76fd9eb13e57348ff43fe1f77bbe909522c67a1
|
sha256: "13065f10e135263a4f5a4391b79a8efc5fb8106f8dd555a9e49b750b45393d77"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.5.2"
|
version: "3.2.3"
|
||||||
freezed_annotation:
|
freezed_annotation:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: freezed_annotation
|
name: freezed_annotation
|
||||||
sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2
|
sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.4"
|
version: "3.1.0"
|
||||||
frontend_server_client:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: frontend_server_client
|
|
||||||
sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "4.0.0"
|
|
||||||
game_tests:
|
game_tests:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -874,10 +850,10 @@ packages:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: json_serializable
|
name: json_serializable
|
||||||
sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b
|
sha256: "6b253f7851cf1626a05c8b49c792e04a14897349798c03798137f2b5f7e0b5b1"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.8.0"
|
version: "6.11.3"
|
||||||
leak_tracker:
|
leak_tracker:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -1259,18 +1235,18 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_gen
|
name: source_gen
|
||||||
sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832"
|
sha256: "07b277b67e0096c45196cbddddf2d8c6ffc49342e88bf31d460ce04605ddac75"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.5.0"
|
version: "4.1.1"
|
||||||
source_helper:
|
source_helper:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_helper
|
name: source_helper
|
||||||
sha256: "86d247119aedce8e63f4751bd9626fc9613255935558447569ad42f9f5b48b3c"
|
sha256: e82b1996c63da42aa3e6a34cc1ec17427728a1baf72ed017717a5669a7123f0d
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.5"
|
version: "1.3.9"
|
||||||
source_span:
|
source_span:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -1391,14 +1367,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.6"
|
version: "0.7.6"
|
||||||
timing:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: timing
|
|
||||||
sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "1.0.2"
|
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ dependencies:
|
||||||
google_sign_in: ^6.2.1
|
google_sign_in: ^6.2.1
|
||||||
|
|
||||||
# Code Generation
|
# Code Generation
|
||||||
freezed_annotation: ^2.4.1
|
freezed_annotation: ^3.1.0
|
||||||
json_annotation: ^4.9.0
|
json_annotation: ^4.9.0
|
||||||
|
|
||||||
# Storage
|
# Storage
|
||||||
|
|
@ -82,7 +82,7 @@ dependencies:
|
||||||
path: ../games/packages/game_tests
|
path: ../games/packages/game_tests
|
||||||
|
|
||||||
collection: any
|
collection: any
|
||||||
copy_with_extension: any
|
copy_with_extension: ^11.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
@ -90,9 +90,9 @@ dev_dependencies:
|
||||||
|
|
||||||
# Code Generation
|
# Code Generation
|
||||||
build_runner: ^2.4.13
|
build_runner: ^2.4.13
|
||||||
freezed: ^2.4.5
|
freezed: ^3.2.3
|
||||||
json_serializable: ^6.8.0
|
json_serializable: ^6.8.0
|
||||||
copy_with_extension_gen: ^5.0.4
|
copy_with_extension_gen: ^11.0.0
|
||||||
|
|
||||||
# Linting
|
# Linting
|
||||||
flutter_lints: ^6.0.0
|
flutter_lints: ^6.0.0
|
||||||
|
|
@ -100,6 +100,10 @@ dev_dependencies:
|
||||||
# yx_scope_linter: ^1.1.0 # TODO: Добавить когда будет доступна версия
|
# yx_scope_linter: ^1.1.0 # TODO: Добавить когда будет доступна версия
|
||||||
# custom_lint: ^0.5.3
|
# custom_lint: ^0.5.3
|
||||||
|
|
||||||
|
dependency_overrides:
|
||||||
|
freezed_annotation: ^3.1.0
|
||||||
|
analyzer: ^8.4.1
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue