fix: analyzer issue

This commit is contained in:
misha
2025-11-28 01:00:56 +03:00
parent 9ca09e8137
commit cbeb91a9f0
9 changed files with 75 additions and 75 deletions

View File

@@ -37,10 +37,10 @@ void main() {
dailyNutrition: [],
);
final testDietsPagination = DietsPagination(
const testDietsPagination = DietsPagination(
data: [testDiet],
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
);
setUp(() {

View File

@@ -26,7 +26,7 @@ void main() {
const types = 'light,veg';
const duration = 30;
const sorting = 'name';
final expected = DietsPagination(
const expected = DietsPagination(
data: [
Diet(
id: 1,
@@ -35,10 +35,10 @@ void main() {
image: 'https://someurl.com/img.jpg',
duration: duration,
state: DietState.active,
type: const DietType(light: true, veg: false, carb: false, meat: false),
type: DietType(light: true, veg: false, carb: false, meat: false),
details: 'Test diet description',
dailySchedule: {},
author: const Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false),
author: Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false),
totalLikes: 1,
totalViews: 1,
totalComments: 1,
@@ -47,8 +47,8 @@ void main() {
dailyNutrition: [],
),
],
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
);
when(mockMyDietsService.getDiets(
@@ -83,10 +83,10 @@ void main() {
});
test('getDiets returns pagination with default parameters', () async {
final expected = DietsPagination(
const expected = DietsPagination(
data: [],
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 1, lastPage: 1, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 1, lastPage: 1, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
);
when(mockMyDietsService.getDiets(
@@ -116,7 +116,7 @@ void main() {
const page = 2;
const query = 'wellness';
const duration = 21;
final expected = DietsPagination(
const expected = DietsPagination(
data: [
Diet(
id: 2,
@@ -125,10 +125,10 @@ void main() {
image: 'https://someurl.com/img2.jpg',
duration: duration,
state: DietState.draft,
type: const DietType(light: false, veg: true, carb: false, meat: false),
type: DietType(light: false, veg: true, carb: false, meat: false),
details: '',
dailySchedule: {},
author: const Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true),
author: Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true),
totalLikes: 5,
totalViews: 10,
totalComments: 2,
@@ -137,8 +137,8 @@ void main() {
dailyNutrition: [],
),
],
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 2, lastPage: 2, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 2, lastPage: 2, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
);
when(mockMyDietsService.getDiets(

View File

@@ -23,7 +23,7 @@ void main() {
const types = 'light,veg';
const duration = 30;
const sorting = 'name';
final expected = DietsPagination(
const expected = DietsPagination(
data: [
Diet(
id: 1,
@@ -32,10 +32,10 @@ void main() {
image: 'https://someurl.com/img.jpg',
duration: duration,
state: DietState.active,
type: const DietType(light: true, veg: false, carb: false, meat: false),
type: DietType(light: true, veg: false, carb: false, meat: false),
details: 'Test diet description',
dailySchedule: {},
author: const Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false),
author: Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false),
totalLikes: 1,
totalViews: 1,
totalComments: 1,
@@ -44,8 +44,8 @@ void main() {
dailyNutrition: [],
),
],
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
);
when(
@@ -62,7 +62,7 @@ void main() {
test('getDiets returns pagination with minimal parameters', () async {
const page = 1;
final expected = DietsPagination(
const expected = DietsPagination(
data: [
Diet(
id: 2,
@@ -71,10 +71,10 @@ void main() {
image: 'https://someurl.com/img2.jpg',
duration: 14,
state: DietState.draft,
type: const DietType(light: false, veg: true, carb: false, meat: false),
type: DietType(light: false, veg: true, carb: false, meat: false),
details: '',
dailySchedule: {},
author: const Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true),
author: Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true),
totalLikes: 5,
totalViews: 10,
totalComments: 2,
@@ -83,8 +83,8 @@ void main() {
dailyNutrition: [],
),
],
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
);
when(mockMyDietsService.getDiets(page: page, query: null, state: null, types: null, duration: null, sorting: null)).thenAnswer((_) async => expected);
@@ -102,10 +102,10 @@ void main() {
const query = 'wellness';
const state = 'draft';
const duration = 21;
final expected = DietsPagination(
const expected = DietsPagination(
data: [],
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 2, lastPage: 2, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 2, lastPage: 2, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
);
when(
@@ -123,7 +123,7 @@ void main() {
test('getDiets returns pagination with state filter', () async {
const page = 1;
const state = 'active';
final expected = DietsPagination(
const expected = DietsPagination(
data: [
Diet(
id: 3,
@@ -132,10 +132,10 @@ void main() {
image: 'https://someurl.com/img3.jpg',
duration: 7,
state: DietState.active,
type: const DietType(light: true, veg: true, carb: false, meat: false),
type: DietType(light: true, veg: true, carb: false, meat: false),
details: 'Active diet description',
dailySchedule: {},
author: const Author(authorSlug: 'author-2', authorName: 'Author 2', authorProfileIcon: '', authorIsMe: false),
author: Author(authorSlug: 'author-2', authorName: 'Author 2', authorProfileIcon: '', authorIsMe: false),
totalLikes: 10,
totalViews: 20,
totalComments: 5,
@@ -144,8 +144,8 @@ void main() {
dailyNutrition: [],
),
],
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
);
when(mockMyDietsService.getDiets(page: page, query: null, state: state, types: null, duration: null, sorting: null)).thenAnswer((_) async => expected);
@@ -161,7 +161,7 @@ void main() {
test('getDiets returns pagination with sorting parameter', () async {
const page = 1;
const sorting = 'duration';
final expected = DietsPagination(
const expected = DietsPagination(
data: [
Diet(
id: 4,
@@ -170,10 +170,10 @@ void main() {
image: 'https://someurl.com/img4.jpg',
duration: 60,
state: DietState.personal,
type: const DietType(light: false, veg: false, carb: true, meat: true),
type: DietType(light: false, veg: false, carb: true, meat: true),
details: 'Sorted diet description',
dailySchedule: {},
author: const Author(authorSlug: 'author-3', authorName: 'Author 3', authorProfileIcon: '', authorIsMe: false),
author: Author(authorSlug: 'author-3', authorName: 'Author 3', authorProfileIcon: '', authorIsMe: false),
totalLikes: 15,
totalViews: 30,
totalComments: 8,
@@ -182,8 +182,8 @@ void main() {
dailyNutrition: [],
),
],
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
);
when(mockMyDietsService.getDiets(page: page, query: null, state: null, types: null, duration: null, sorting: sorting)).thenAnswer((_) async => expected);

View File

@@ -14,17 +14,17 @@ void main() {
MyPlansCubit? myPlansCubit;
late MockMyPlansRepository mockMyPlansRepository;
final testPlan = PlanModel(
const testPlan = PlanModel(
id: 1,
slug: 'test-plan',
name: 'Test Plan',
image: 'https://someurl.com/img.jpg',
duration: 30,
state: 'active',
type: const PlanType(fit: true, slim: false, behavior: false, wellness: false),
type: PlanType(fit: true, slim: false, behavior: false, wellness: false),
details: 'Test plan description',
packetsCount: 1,
author: const Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false),
author: Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false),
totalLikes: 1,
totalViews: 1,
totalComments: 1,
@@ -34,9 +34,9 @@ void main() {
wasLikedByMe: false,
);
final testPlansPagination = PlanPaginationModel(
const testPlansPagination = PlanPaginationModel(
data: [testPlan],
links: const Links(first: '', last: '', prev: null, next: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null, totalMinPrice: 100, totalMaxPrice: 500),
);

View File

@@ -26,17 +26,17 @@ void main() {
late MockMyPlansRepository mockMyPlansRepository;
late MyPlansCubit myPlansCubit;
final testPlan = PlanModel(
const testPlan = PlanModel(
id: 1,
slug: 'test-plan',
name: 'Test Plan',
image: 'test-image.jpg',
duration: 30,
state: 'active',
type: const PlanType(fit: true, slim: false, behavior: false, wellness: false),
type: PlanType(fit: true, slim: false, behavior: false, wellness: false),
details: 'Test plan description',
packetsCount: 1,
author: const Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false),
author: Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false),
totalLikes: 1,
totalViews: 1,
totalComments: 1,
@@ -96,7 +96,7 @@ void main() {
testWidgets('should display MyPlanWidget with plan name', (WidgetTester tester) async {
// Arrange
myPlansCubit.emit(MyPlansState(selectedStateIndex: 0));
final widget = MyPlanWidget(plan: testPlan);
const widget = MyPlanWidget(plan: testPlan);
// Act
await tester.pumpWidget(createTestWidget(widget));
@@ -112,7 +112,7 @@ void main() {
testWidgets('should display MyPlanWidget with description when details are present', (WidgetTester tester) async {
// Arrange
myPlansCubit.emit(MyPlansState(selectedStateIndex: 0));
final widget = MyPlanWidget(plan: testPlan);
const widget = MyPlanWidget(plan: testPlan);
// Act
await tester.pumpWidget(createTestWidget(widget));
@@ -128,7 +128,7 @@ void main() {
testWidgets('should display MyPlanWidget with price', (WidgetTester tester) async {
// Arrange
myPlansCubit.emit(MyPlansState(selectedStateIndex: 0));
final widget = MyPlanWidget(plan: testPlan);
const widget = MyPlanWidget(plan: testPlan);
// Act
await tester.pumpWidget(createTestWidget(widget));
@@ -144,7 +144,7 @@ void main() {
testWidgets('should display MyPlanWidget buttons', (WidgetTester tester) async {
// Arrange
myPlansCubit.emit(MyPlansState(selectedStateIndex: 0));
final widget = MyPlanWidget(plan: testPlan);
const widget = MyPlanWidget(plan: testPlan);
// Act
await tester.pumpWidget(createTestWidget(widget));
@@ -160,7 +160,7 @@ void main() {
testWidgets('should display MyPlanWidget structure correctly', (WidgetTester tester) async {
// Arrange
myPlansCubit.emit(MyPlansState(selectedStateIndex: 0));
final widget = MyPlanWidget(plan: testPlan);
const widget = MyPlanWidget(plan: testPlan);
// Act
await tester.pumpWidget(createTestWidget(widget));

View File

@@ -85,7 +85,7 @@ void main() {
});
test('getPlans returns pagination with default parameters', () async {
final expected = PlanPaginationModel(
const expected = PlanPaginationModel(
data: [
PlanModel(
id: 2,
@@ -94,10 +94,10 @@ void main() {
image: 'https://someurl.com/img2.jpg',
duration: 14,
state: 'draft',
type: const PlanType(fit: false, slim: true, behavior: false, wellness: false),
type: PlanType(fit: false, slim: true, behavior: false, wellness: false),
details: '',
packetsCount: 2,
author: const Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true),
author: Author(authorSlug: 'author-slug', authorName: 'Author Name', authorProfileIcon: '', authorIsMe: true),
totalLikes: 5,
totalViews: 10,
totalComments: 2,
@@ -107,8 +107,8 @@ void main() {
wasLikedByMe: true,
),
],
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 1, lastPage: 1, total: 1, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
);
when(mockMyPlansService.getPlans(
@@ -139,10 +139,10 @@ void main() {
const page = 2;
const query = 'wellness';
const duration = 21;
final expected = PlanPaginationModel(
const expected = PlanPaginationModel(
data: [],
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 2, lastPage: 2, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
links: Links(first: '', last: '', prev: null, next: null),
meta: Meta(currentPage: 2, lastPage: 2, total: 0, perPage: 10, from: null, links: [Link(url: null, label: null, active: null)], to: null),
);
when(mockMyPlansService.getPlans(

View File

@@ -20,7 +20,7 @@ void main() {
late MockMyRecipesRepository mockMyRecipesRepository;
late MockAboutRecipeRepository mockAboutRecipeRepository;
final testActiveRecipe = MyRecipeModel(
const testActiveRecipe = MyRecipeModel(
id: 1,
image: 'https://someurl.com/img.jpg',
state: 'active',
@@ -28,7 +28,7 @@ void main() {
activeCookingTime: 20,
description: 'Test recipe description',
steps: [
const Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'),
Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'),
],
videoUrl: 'https://someurl.com/video.mp4',
title: 'Test Recipe',
@@ -38,7 +38,7 @@ void main() {
viewsCount: 10,
);
final testArchivedRecipe = MyRecipeModel(
const testArchivedRecipe = MyRecipeModel(
id: 2,
image: 'https://someurl.com/img2.jpg',
state: 'archived',

View File

@@ -20,7 +20,7 @@ void main() {
});
test('getMyRecipes returns list of recipes', () async {
final expectedPagination = MyRecipePaginationModel(
const expectedPagination = MyRecipePaginationModel(
data: [
MyRecipeModel(
id: 1,
@@ -30,7 +30,7 @@ void main() {
activeCookingTime: 20,
description: 'Test recipe description',
steps: [
const Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'),
Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'),
],
videoUrl: 'https://someurl.com/video.mp4',
title: 'Test Recipe',
@@ -54,7 +54,7 @@ void main() {
});
test('getMyRecipes returns empty list', () async {
final expectedPagination = MyRecipePaginationModel(
const expectedPagination = MyRecipePaginationModel(
data: [],
);
@@ -68,7 +68,7 @@ void main() {
});
test('getMyRecipes returns multiple recipes', () async {
final expectedPagination = MyRecipePaginationModel(
const expectedPagination = MyRecipePaginationModel(
data: [
MyRecipeModel(
id: 1,
@@ -93,7 +93,7 @@ void main() {
activeCookingTime: 30,
description: 'Second recipe',
steps: [
const Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1'),
Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1'),
],
videoUrl: 'https://someurl.com/video.mp4',
title: 'Second Recipe',

View File

@@ -17,7 +17,7 @@ void main() {
});
test('getMyRecipes returns pagination with recipes', () async {
final expected = MyRecipePaginationModel(
const expected = MyRecipePaginationModel(
data: [
MyRecipeModel(
id: 1,
@@ -27,8 +27,8 @@ void main() {
activeCookingTime: 20,
description: 'Test recipe description',
steps: [
const Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'),
const Step(image: 'https://someurl.com/step2.jpg', description: 'Step 2 description'),
Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1 description'),
Step(image: 'https://someurl.com/step2.jpg', description: 'Step 2 description'),
],
videoUrl: 'https://someurl.com/video.mp4',
title: 'Test Recipe',
@@ -52,7 +52,7 @@ void main() {
});
test('getMyRecipes returns pagination with multiple recipes', () async {
final expected = MyRecipePaginationModel(
const expected = MyRecipePaginationModel(
data: [
MyRecipeModel(
id: 1,
@@ -62,7 +62,7 @@ void main() {
activeCookingTime: 20,
description: 'First recipe description',
steps: [
const Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1'),
Step(image: 'https://someurl.com/step1.jpg', description: 'Step 1'),
],
videoUrl: 'https://someurl.com/video1.mp4',
title: 'First Recipe',
@@ -101,7 +101,7 @@ void main() {
});
test('getMyRecipes returns empty pagination', () async {
final expected = MyRecipePaginationModel(
const expected = MyRecipePaginationModel(
data: [],
);
@@ -115,7 +115,7 @@ void main() {
});
test('getMyRecipes returns recipe with null steps and videoUrl', () async {
final expected = MyRecipePaginationModel(
const expected = MyRecipePaginationModel(
data: [
MyRecipeModel(
id: 3,