Conversation
|
|
lib/features/message/presentation/bloc/message_animation/message_animation_cubit.dart
Show resolved
Hide resolved
lib/features/message/presentation/bloc/base_message/base_message_bloc.dart
Outdated
Show resolved
Hide resolved
lib/features/message/presentation/bloc/base_message/base_message_bloc.dart
Outdated
Show resolved
Hide resolved
lib/features/message/data/repository_impl/message_repository_impl.dart
Outdated
Show resolved
Hide resolved
lib/features/message/data/datasource_impl/remote_message_datasource_impl.dart
Outdated
Show resolved
Hide resolved
lib/features/message/data/repository_impl/message_repository_impl.dart
Outdated
Show resolved
Hide resolved
|
|
||
| part 'base_message_event.dart'; | ||
|
|
||
| part 'base_message_state.dart'; |
There was a problem hiding this comment.
It is recommended to use absolute path
There was a problem hiding this comment.
Hi! Thanks for the work, now everything is done on сubits and I don't see the point in adding new blocks with events, it's better to keep everything on сubits IMHO
| final threadId = event.threadId ?? Globals.instance.threadId; | ||
|
|
||
| List<Message> lastList = const []; | ||
| await for (var list in stream) { |
There was a problem hiding this comment.
IMO, Should be split into smaller functions
|
|
||
| emit(MessagesLoadSuccess( | ||
| messages: list, | ||
| hash: list.fold(0, (acc, m) => acc + m.hash), |
There was a problem hiding this comment.
IMO, Create function to generate hash key
| }); | ||
|
|
||
| @override | ||
| List<Object?> get props => []; |
There was a problem hiding this comment.
IMO, properties should be added to props for future comparison.
| Duration(milliseconds: 50), | ||
| FocusManager.instance.primaryFocus?.unfocus, | ||
| ); | ||
| Get.find<MessageAnimationCubit>().endAnimation(); |
There was a problem hiding this comment.
It is recommended to use Get.find centralized in one place
dab246
left a comment
There was a problem hiding this comment.
Quick review:
- Objects should be
immutable - Fill in
propertiesinprops - Should create
instanceofGet.findand use it. Avoid writing: `Get.find().function() - Should create separate function for events in call from
onTap,onClick - Note
convension code:- There are too many parameters of the function, each parameter should be
1 line. - Indentation should be
1 tab
- There are too many parameters of the function, each parameter should be
|
|
||
| part 'base_message_event.dart'; | ||
|
|
||
| part 'base_message_state.dart'; |
There was a problem hiding this comment.
Hi! Thanks for the work, now everything is done on сubits and I don't see the point in adding new blocks with events, it's better to keep everything on сubits IMHO
Hi! Reason to change some cubit to bloc:
|
9c6fb44 to
1abcb50
Compare
1abcb50 to
47a445e
Compare
| import 'package:twake/core/state/success.dart'; | ||
|
|
||
| @immutable | ||
| abstract class AppState with EquatableMixin { |
| this._messageRepository, | ||
| ); | ||
|
|
||
| Either<ExceptionFailure, Stream<List<Message>>> execute({ String? companyId, |
| import 'package:flutter/material.dart'; | ||
| import 'package:twake/models/globals/globals.dart'; | ||
|
|
||
| abstract class RepositoryHelper { |
| if (!Globals.instance.isNetworkConnected) { | ||
| onLocal?.call(); | ||
| return; | ||
| } | ||
| onRemote?.call(); |
There was a problem hiding this comment.
IMO, it is not generic enough. For example: when we need to first: fetch data from local, in parallel, fetch the data with network to update.
| @@ -51,9 +51,11 @@ class MessageBloc extends Bloc<MessageEvent, MessageState> { | |||
| if (event.threadId == null) emit(MessagesLoadInProgress()); | |||
|
|
|||
| final result = _fetchMessageUseCase.execute( | |||
There was a problem hiding this comment.
IMO, we need an method to execute all the usecase
No description provided.