refactor(linter): Перейти на friflex_linter, обновить правила

This commit is contained in:
PetrovY
2025-05-28 16:38:56 +03:00
parent 31507ae230
commit c6d4700892
61 changed files with 691 additions and 366 deletions

View File

@@ -1,4 +1,4 @@
import '../../domain/repository/i_profile_repository.dart';
import 'package:friflex_starter/features/profile/domain/repository/i_profile_repository.dart';
/// {@template ProfileMockRepository}
///

View File

@@ -1,14 +1,14 @@
import 'package:friflex_starter/app/http/i_http_client.dart';
import '../../domain/repository/i_profile_repository.dart';
import 'package:friflex_starter/features/profile/domain/repository/i_profile_repository.dart';
/// {@template ProfileRepository}
///
/// {@endtemplate}
final class ProfileRepository implements IProfileRepository {
final IHttpClient httpClient;
ProfileRepository({required this.httpClient});
final IHttpClient httpClient;
@override
String get name => 'ProfileRepository';

View File

@@ -8,9 +8,9 @@ sealed class ProfileEvent extends Equatable {
}
final class ProfileFetchProfileEvent extends ProfileEvent {
final String id;
const ProfileFetchProfileEvent({required this.id});
final String id;
@override
List<Object> get props => [id];

View File

@@ -12,24 +12,24 @@ final class ProfileInitialState extends ProfileState {}
final class ProfileWaitingState extends ProfileState {}
final class ProfileErrorState extends ProfileState {
final String message;
final Object error;
final StackTrace? stackTrace;
const ProfileErrorState({
required this.message,
required this.error,
this.stackTrace,
});
final String message;
final Object error;
final StackTrace? stackTrace;
@override
List<Object> get props => [message, error];
}
final class ProfileSuccessState extends ProfileState {
final Object data;
const ProfileSuccessState({required this.data});
final Object data;
@override
List<Object> get props => [data];

View File

@@ -16,17 +16,16 @@ abstract final class ProfileRoutes {
static StatefulShellBranch buildShellBranch({
List<RouteBase> routes = const [],
List<NavigatorObserver>? observers,
}) =>
StatefulShellBranch(
initialLocation: _profileScreenPath,
observers: observers,
routes: [
GoRoute(
path: _profileScreenPath,
name: profileScreenName,
builder: (context, state) => const ProfileScreen(),
routes: routes,
),
],
);
}) => StatefulShellBranch(
initialLocation: _profileScreenPath,
observers: observers,
routes: [
GoRoute(
path: _profileScreenPath,
name: profileScreenName,
builder: (context, state) => const ProfileScreen(),
routes: routes,
),
],
);
}

View File

@@ -15,8 +15,9 @@ class ProfileScreen extends StatelessWidget {
// и вызываем событие ProfileFetchProfileEvent
// Или любые другие события, которые вам нужны
return BlocProvider(
create: (context) => ProfileBloc(profileRepository)
..add(const ProfileFetchProfileEvent(id: '1')),
create: (context) =>
ProfileBloc(profileRepository)
..add(const ProfileFetchProfileEvent(id: '1')),
child: const _ProfileScreenView(),
);
}
@@ -29,9 +30,7 @@ class _ProfileScreenView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Profile'),
),
appBar: AppBar(title: const Text('Profile')),
body: Center(
child: BlocBuilder<ProfileBloc, ProfileState>(
builder: (context, state) {