refactor: Enable more strict lints

This commit is contained in:
Christian Kußowski 2026-02-24 10:04:40 +01:00
commit 28af7bb0c7
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
65 changed files with 170 additions and 146 deletions

View file

@ -121,7 +121,7 @@ class ChatController extends State<ChatPageWithRoom>
void onDragExited(_) => setState(() => dragging = false);
void onDragDone(DropDoneDetails details) async {
Future<void> onDragDone(DropDoneDetails details) async {
setState(() => dragging = false);
if (details.files.isEmpty) return;
@ -190,7 +190,7 @@ class ChatController extends State<ChatPageWithRoom>
selectedEvents.clear();
});
void recreateChat() async {
Future<void> recreateChat() async {
final room = this.room;
final userId = room.directChatMatrixID;
if (userId == null) {
@ -204,7 +204,7 @@ class ChatController extends State<ChatPageWithRoom>
);
}
void leaveChat() async {
Future<void> leaveChat() async {
final success = await showFutureLoadingDialog(
context: context,
future: room.leave,
@ -213,12 +213,12 @@ class ChatController extends State<ChatPageWithRoom>
context.go('/rooms');
}
void requestHistory([_]) async {
Future<void> requestHistory([_]) async {
Logs().v('Requesting history...');
await timeline?.requestHistory(historyCount: _loadHistoryCount);
}
void requestFuture() async {
Future<void> requestFuture() async {
final timeline = this.timeline;
if (timeline == null) return;
Logs().v('Requesting future...');
@ -392,7 +392,7 @@ class ChatController extends State<ChatPageWithRoom>
});
}
void _tryLoadTimeline() async {
Future<void> _tryLoadTimeline() async {
final initialEventId = widget.eventId;
loadTimelineFuture = _getTimeline();
try {
@ -625,7 +625,7 @@ class ChatController extends State<ChatPageWithRoom>
});
}
void sendFileAction({FileType type = FileType.any}) async {
Future<void> sendFileAction({FileType type = FileType.any}) async {
final files = await selectFiles(context, allowMultiple: true, type: type);
if (files.isEmpty) return;
await showAdaptiveDialog(
@ -640,7 +640,7 @@ class ChatController extends State<ChatPageWithRoom>
);
}
void sendImageFromClipBoard(Uint8List? image) async {
Future<void> sendImageFromClipBoard(Uint8List? image) async {
if (image == null) return;
await showAdaptiveDialog(
context: context,
@ -654,7 +654,7 @@ class ChatController extends State<ChatPageWithRoom>
);
}
void openCameraAction() async {
Future<void> openCameraAction() async {
// Make sure the textfield is unfocused before opening the camera
FocusScope.of(context).requestFocus(FocusNode());
final file = await ImagePicker().pickImage(source: ImageSource.camera);
@ -672,7 +672,7 @@ class ChatController extends State<ChatPageWithRoom>
);
}
void openVideoCameraAction() async {
Future<void> openVideoCameraAction() async {
// Make sure the textfield is unfocused before opening the camera
FocusScope.of(context).requestFocus(FocusNode());
final file = await ImagePicker().pickVideo(
@ -759,7 +759,7 @@ class ChatController extends State<ChatPageWithRoom>
}
}
void sendLocationAction() async {
Future<void> sendLocationAction() async {
await showAdaptiveDialog(
context: context,
builder: (c) => SendLocationDialog(room: room),
@ -793,7 +793,7 @@ class ChatController extends State<ChatPageWithRoom>
});
}
void reportEventAction() async {
Future<void> reportEventAction() async {
final event = selectedEvents.single;
final score = await showModalActionPopup<int>(
context: context,
@ -837,7 +837,7 @@ class ChatController extends State<ChatPageWithRoom>
);
}
void deleteErrorEventsAction() async {
Future<void> deleteErrorEventsAction() async {
try {
if (selectedEvents.any((event) => event.status != EventStatus.error)) {
throw Exception(
@ -856,7 +856,7 @@ class ChatController extends State<ChatPageWithRoom>
}
}
void redactEventsAction() async {
Future<void> redactEventsAction() async {
final reasonInput = selectedEvents.any((event) => event.status.isSent)
? await showTextInputDialog(
context: context,
@ -949,7 +949,7 @@ class ChatController extends State<ChatPageWithRoom>
);
}
void forwardEventsAction() async {
Future<void> forwardEventsAction() async {
if (selectedEvents.isEmpty) return;
final timeline = this.timeline;
if (timeline == null) return;
@ -992,7 +992,10 @@ class ChatController extends State<ChatPageWithRoom>
inputFocus.requestFocus();
}
void scrollToEventId(String eventId, {bool highlightEvent = true}) async {
Future<void> scrollToEventId(
String eventId, {
bool highlightEvent = true,
}) async {
final foundEvent = timeline!.events.firstWhereOrNull(
(event) => event.eventId == eventId,
);
@ -1036,7 +1039,7 @@ class ChatController extends State<ChatPageWithRoom>
_updateScrollController();
}
void scrollDown() async {
Future<void> scrollDown() async {
if (!timeline!.allowNewEvent) {
setState(() {
timeline = null;
@ -1117,7 +1120,7 @@ class ChatController extends State<ChatPageWithRoom>
inputFocus.requestFocus();
}
void goToNewRoomAction() async {
Future<void> goToNewRoomAction() async {
final result = await showFutureLoadingDialog(
context: context,
future: () async {
@ -1216,7 +1219,7 @@ class ChatController extends State<ChatPageWithRoom>
}
}
void unpinEvent(String eventId) async {
Future<void> unpinEvent(String eventId) async {
final response = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).unpin,
@ -1309,7 +1312,7 @@ class ChatController extends State<ChatPageWithRoom>
void showEventInfo([Event? event]) =>
(event ?? selectedEvents.single).showInfoDialog(context);
void onPhoneButtonTap() async {
Future<void> onPhoneButtonTap() async {
// VoIP required Android SDK 21
if (PlatformInfos.isAndroid) {
DeviceInfoPlugin().androidInfo.then((value) {
@ -1365,7 +1368,7 @@ class ChatController extends State<ChatPageWithRoom>
late final ValueNotifier<bool> _displayChatDetailsColumn;
void toggleDisplayChatDetailsColumn() async {
Future<void> toggleDisplayChatDetailsColumn() async {
await AppSettings.displayChatDetailsColumn.setItem(
!_displayChatDetailsColumn.value,
);

View file

@ -124,7 +124,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
}
}
void _onButtonTap() async {
Future<void> _onButtonTap() async {
WidgetsBinding.instance.addPostFrameCallback((_) {
ScaffoldMessenger.of(matrix.context).clearMaterialBanners();
});
@ -216,7 +216,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
);
}
void _toggleSpeed() async {
Future<void> _toggleSpeed() async {
final audioPlayer = matrix.audioPlayer;
if (audioPlayer == null) return;
switch (audioPlayer.speed) {
@ -459,7 +459,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
height: 20,
child: Center(
child: Text(
'${audioPlayer?.speed.toString()}x',
'${audioPlayer?.speed}x',
style: TextStyle(
color: widget.color,
fontSize: 9,

View file

@ -47,7 +47,7 @@ class MessageContent extends StatelessWidget {
required this.selected,
});
void _verifyOrRequestKey(BuildContext context) async {
Future<void> _verifyOrRequestKey(BuildContext context) async {
final l10n = L10n.of(context);
if (event.content['can_request_session'] != true) {
ScaffoldMessenger.of(context).showSnackBar(

View file

@ -411,7 +411,7 @@ class InputBar extends StatelessWidget {
),
minLines: minLines,
maxLines: maxLines,
keyboardType: keyboardType!,
keyboardType: keyboardType,
textInputAction: textInputAction,
autofocus: autofocus!,
inputFormatters: [

View file

@ -164,7 +164,7 @@ class RecordingViewModelState extends State<RecordingViewModel> {
});
}
void stopAndSend(
Future<void> stopAndSend(
Future<void> Function(
String path,
int duration,

View file

@ -35,7 +35,7 @@ class ReplyDisplay extends StatelessWidget {
child: controller.replyEvent != null
? ReplyContent(
controller.replyEvent!,
timeline: controller.timeline!,
timeline: controller.timeline,
)
: _EditContent(
controller.editEvent?.getDisplayEvent(controller.timeline!),

View file

@ -73,7 +73,7 @@ class SendLocationDialogState extends State<SendLocationDialog> {
}
}
void sendAction() async {
Future<void> sendAction() async {
setState(() => isSending = true);
final body =
'https://www.openstreetmap.org/?mlat=${position!.latitude}&mlon=${position!.longitude}#map=16/${position!.latitude}/${position!.longitude}';

View file

@ -28,7 +28,7 @@ class _StartPollBottomSheetState extends State<StartPollBottomSheet> {
String? _txid;
void _createPoll() async {
Future<void> _createPoll() async {
try {
var id = 0;
_txid ??= widget.room.client.generateUniqueTransactionId();