dart format

This commit is contained in:
2026-05-08 20:12:40 +02:00
parent 9e139b5704
commit 3b8da1d3d6
295 changed files with 6404 additions and 4161 deletions
@@ -11,7 +11,9 @@ import '../repository/chat_list_repository.dart';
import 'chat_list_event.dart';
import 'chat_list_state.dart';
class ChatListBloc extends LoadableHydratedBloc<ChatListEvent, ChatListState, ChatListRepository> {
class ChatListBloc
extends
LoadableHydratedBloc<ChatListEvent, ChatListState, ChatListRepository> {
bool _forceRenew = false;
@override
@@ -27,7 +29,8 @@ class ChatListBloc extends LoadableHydratedBloc<ChatListEvent, ChatListState, Ch
ChatListState fromNothing() => const ChatListState();
@override
ChatListState fromStorage(Map<String, dynamic> json) => ChatListState.fromJson(json);
ChatListState fromStorage(Map<String, dynamic> json) =>
ChatListState.fromJson(json);
@override
Map<String, dynamic>? toStorage(ChatListState state) => state.toJson();
@@ -62,11 +65,15 @@ class ChatListBloc extends LoadableHydratedBloc<ChatListEvent, ChatListState, Ch
capturedError = e;
}
if (capturedError != null) {
add(Error(LoadingError(
message: errorToUserMessage(capturedError),
technicalDetails: errorToTechnicalDetails(capturedError),
allowRetry: errorAllowsRetry(capturedError),
)));
add(
Error(
LoadingError(
message: errorToUserMessage(capturedError),
technicalDetails: errorToTechnicalDetails(capturedError),
allowRetry: errorAllowsRetry(capturedError),
),
),
);
}
}
@@ -77,7 +84,10 @@ class ChatListBloc extends LoadableHydratedBloc<ChatListEvent, ChatListState, Ch
void _updateAppBadge(GetRoomResponse rooms) {
try {
final unread = rooms.data.fold<int>(0, (a, room) => a + room.unreadMessages);
final unread = rooms.data.fold<int>(
0,
(a, room) => a + room.unreadMessages,
);
FlutterAppBadge.count(unread);
} on Object catch (e) {
log('Failed to update app badge: $e');
@@ -7,9 +7,8 @@ part 'chat_list_state.g.dart';
@freezed
abstract class ChatListState with _$ChatListState {
const factory ChatListState({
GetRoomResponse? rooms,
}) = _ChatListState;
const factory ChatListState({GetRoomResponse? rooms}) = _ChatListState;
factory ChatListState.fromJson(Map<String, Object?> json) => _$ChatListStateFromJson(json);
factory ChatListState.fromJson(Map<String, Object?> json) =>
_$ChatListStateFromJson(json);
}
@@ -8,16 +8,12 @@ class ChatListDataProvider {
Future<GetRoomResponse> getRooms({
void Function(Object)? onError,
bool renew = false,
}) =>
resolveFromCache<GetRoomResponse>(
(onUpdate, onError) => GetRoomCache(
renew: renew,
onUpdate: onUpdate,
onError: onError,
),
onError: onError,
operationName: 'getRooms',
);
}) => resolveFromCache<GetRoomResponse>(
(onUpdate, onError) =>
GetRoomCache(renew: renew, onUpdate: onUpdate, onError: onError),
onError: onError,
operationName: 'getRooms',
);
Future<void> createDirectRoom(String invite) =>
CreateRoom(CreateRoomParams(roomType: 1, invite: invite)).run();
@@ -5,7 +5,8 @@ import '../data_provider/chat_list_data_provider.dart';
class ChatListRepository extends Repository<ChatListState> {
final ChatListDataProvider _provider;
ChatListRepository([ChatListDataProvider? provider]) : _provider = provider ?? ChatListDataProvider();
ChatListRepository([ChatListDataProvider? provider])
: _provider = provider ?? ChatListDataProvider();
ChatListDataProvider get data => _provider;
}