Merge pull request #2612 from krille-chan/krille/enable-more-strict-lints

refactor: Enable more strict lints
This commit is contained in:
Krille-chan 2026-02-24 10:26:41 +01:00 committed by GitHub
commit c40c9cc70f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 170 additions and 146 deletions

View file

@ -11,6 +11,7 @@ linter:
- omit_local_variable_types
- cancel_subscriptions
- always_declare_return_types
- avoid_void_async
- no_adjacent_strings_in_list
- test_types_in_equals
- throw_in_finally
@ -19,6 +20,15 @@ linter:
- prefer_single_quotes
- prefer_const_declarations
- unnecessary_lambdas
- combinators_ordering
- noop_primitive_operations
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_to_list_in_spreads
- use_is_even_rather_than_modulo
- use_super_parameters
# Flutter specific:
- use_colored_box
analyzer:
plugins:
@ -61,7 +71,6 @@ dart_code_linter:
- prefer-correct-edge-insets-constructor
- avoid-returning-widgets
# TODO:
# - avoid-returning-widgets
# - prefer-single-widget-per-file:
# ignore-private-widgets: true
# - prefer-extracting-callbacks

View file

@ -23,7 +23,7 @@ class ArchiveController extends State<Archive> {
return archive = await Matrix.of(context).client.loadArchive();
}
void forgetRoomAction(int i) async {
Future<void> forgetRoomAction(int i) async {
await showFutureLoadingDialog(
context: context,
future: () async {
@ -35,7 +35,7 @@ class ArchiveController extends State<Archive> {
setState(() {});
}
void forgetAllAction() async {
Future<void> forgetAllAction() async {
final archive = this.archive;
final client = Matrix.of(context).client;
if (archive.isEmpty) return;

View file

@ -71,7 +71,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
_createBootstrap(widget.wipe);
}
void _cancelAction() async {
Future<void> _cancelAction() async {
final consent = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).skipChatBackup,
@ -110,7 +110,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
}
}
void _createBootstrap(bool wipe) async {
Future<void> _createBootstrap(bool wipe) async {
await client.roomsLoading;
await client.accountDataLoading;
await client.userDeviceKeysLoading;

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();

View file

@ -78,7 +78,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
return joinRules.toList();
}
void setJoinRule(JoinRules? newJoinRules) async {
Future<void> setJoinRule(JoinRules? newJoinRules) async {
if (newJoinRules == null) return;
setState(() {
joinRulesLoading = true;
@ -111,7 +111,9 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
}
}
void setHistoryVisibility(HistoryVisibility? historyVisibility) async {
Future<void> setHistoryVisibility(
HistoryVisibility? historyVisibility,
) async {
if (historyVisibility == null) return;
setState(() {
historyVisibilityLoading = true;
@ -135,7 +137,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
}
}
void setGuestAccess(GuestAccess? guestAccess) async {
Future<void> setGuestAccess(GuestAccess? guestAccess) async {
if (guestAccess == null) return;
setState(() {
guestAccessLoading = true;
@ -159,7 +161,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
}
}
void updateRoomAction() async {
Future<void> updateRoomAction() async {
final roomVersion = room
.getState(EventTypes.RoomCreate)!
.content
@ -303,7 +305,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
);
}
void deleteAlias(String alias) async {
Future<void> deleteAlias(String alias) async {
await showFutureLoadingDialog(
context: context,
future: () => room.client.deleteRoomAlias(alias),
@ -311,7 +313,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
setState(() {});
}
void setChatVisibilityOnDirectory(bool? visibility) async {
Future<void> setChatVisibilityOnDirectory(bool? visibility) async {
if (visibility == null) return;
setState(() {
visibilityLoading = true;

View file

@ -38,7 +38,7 @@ class ChatDetailsController extends State<ChatDetails> {
String? get roomId => widget.roomId;
void setDisplaynameAction() async {
Future<void> setDisplaynameAction() async {
final room = Matrix.of(context).client.getRoomById(roomId!)!;
final input = await showTextInputDialog(
context: context,
@ -59,7 +59,7 @@ class ChatDetailsController extends State<ChatDetails> {
}
}
void setTopicAction() async {
Future<void> setTopicAction() async {
final room = Matrix.of(context).client.getRoomById(roomId!)!;
final input = await showTextInputDialog(
context: context,
@ -83,7 +83,7 @@ class ChatDetailsController extends State<ChatDetails> {
}
}
void setAvatarAction() async {
Future<void> setAvatarAction() async {
final room = Matrix.of(context).client.getRoomById(roomId!);
final actions = [
if (PlatformInfos.isMobile)

View file

@ -30,7 +30,7 @@ class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
}
}
void enableEncryption(_) async {
Future<void> enableEncryption(_) async {
if (room.encrypted) {
showOkAlertDialog(
context: context,
@ -69,7 +69,7 @@ class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
);
}
void startVerification() async {
Future<void> startVerification() async {
final consent = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).verifyOtherUser,

View file

@ -78,7 +78,7 @@ class ChatListController extends State<ChatList>
String? _activeSpaceId;
String? get activeSpaceId => _activeSpaceId;
void setActiveSpace(String spaceId) async {
Future<void> setActiveSpace(String spaceId) async {
await Matrix.of(context).client.getRoomById(spaceId)!.postLoad();
setState(() {
@ -90,7 +90,7 @@ class ChatListController extends State<ChatList>
_activeSpaceId = null;
});
void onChatTap(Room room) async {
Future<void> onChatTap(Room room) async {
if (room.membership == Membership.invite) {
final joinResult = await showFutureLoadingDialog(
context: context,
@ -156,7 +156,7 @@ class ChatListController extends State<ChatList>
bool isSearching = false;
static const String _serverStoreNamespace = 'im.fluffychat.search.server';
void setServer() async {
Future<void> setServer() async {
final newServer = await showTextInputDialog(
useRootNavigator: false,
title: L10n.of(context).changeTheHomeserver,
@ -184,7 +184,7 @@ class ChatListController extends State<ChatList>
final TextEditingController searchController = TextEditingController();
final FocusNode searchFocusNode = FocusNode();
void _search() async {
Future<void> _search() async {
final client = Matrix.of(context).client;
if (!isSearching) {
setState(() {
@ -292,7 +292,7 @@ class ChatListController extends State<ChatList>
}
}
void editSpace(BuildContext context, String spaceId) async {
Future<void> editSpace(BuildContext context, String spaceId) async {
await Matrix.of(context).client.getRoomById(spaceId)!.postLoad();
if (mounted) {
context.push('/rooms/$spaceId/details');
@ -326,7 +326,7 @@ class ChatListController extends State<ChatList>
);
}
void _processIncomingUris(Uri? uri) async {
Future<void> _processIncomingUris(Uri? uri) async {
if (uri == null) return;
context.go('/rooms');
WidgetsBinding.instance.addPostFrameCallback((_) {
@ -399,7 +399,7 @@ class ChatListController extends State<ChatList>
super.dispose();
}
void chatContextAction(
Future<void> chatContextAction(
Room room,
BuildContext posContext, [
Room? space,
@ -671,7 +671,7 @@ class ChatListController extends State<ChatList>
}
}
void dismissStatusList() async {
Future<void> dismissStatusList() async {
final result = await showOkCancelAlertDialog(
title: L10n.of(context).hidePresences,
context: context,
@ -682,7 +682,7 @@ class ChatListController extends State<ChatList>
}
}
void setStatus() async {
Future<void> setStatus() async {
final client = Matrix.of(context).client;
final currentPresence = await client.fetchCurrentPresence(client.userID!);
final input = await showTextInputDialog(
@ -793,7 +793,10 @@ class ChatListController extends State<ChatList>
});
}
void editBundlesForAccount(String? userId, String? activeBundle) async {
Future<void> editBundlesForAccount(
String? userId,
String? activeBundle,
) async {
final l10n = L10n.of(context);
final client = Matrix.of(
context,

View file

@ -194,7 +194,7 @@ class ClientChooserButton extends StatelessWidget {
);
}
void _clientSelected(Object object, BuildContext context) async {
Future<void> _clientSelected(Object object, BuildContext context) async {
if (object is Client) {
controller.setActiveClient(object);
} else if (object is String) {

View file

@ -52,7 +52,7 @@ class SearchTitle extends StatelessWidget {
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: trailing!,
child: trailing,
),
),
],

View file

@ -60,7 +60,7 @@ class _SpaceViewState extends State<SpaceView> {
super.initState();
}
void _loadHierarchy() async {
Future<void> _loadHierarchy() async {
final matrix = Matrix.of(context);
final room = matrix.client.getRoomById(widget.spaceId);
if (room == null) return;
@ -127,7 +127,7 @@ class _SpaceViewState extends State<SpaceView> {
}
}
void _joinChildRoom(SpaceRoomsChunk$2 item) async {
Future<void> _joinChildRoom(SpaceRoomsChunk$2 item) async {
final client = Matrix.of(context).client;
final space = client.getRoomById(widget.spaceId);
final via = space?.spaceChildren
@ -146,7 +146,7 @@ class _SpaceViewState extends State<SpaceView> {
if (room != null) widget.onChatTab(room);
}
void _onSpaceAction(SpaceActions action) async {
Future<void> _onSpaceAction(SpaceActions action) async {
final space = Matrix.of(context).client.getRoomById(widget.spaceId);
switch (action) {
@ -184,7 +184,7 @@ class _SpaceViewState extends State<SpaceView> {
}
}
void _addChatOrSubspace(AddRoomType roomType) async {
Future<void> _addChatOrSubspace(AddRoomType roomType) async {
final names = await showTextInputDialog(
context: context,
title: roomType == AddRoomType.subspace
@ -261,7 +261,10 @@ class _SpaceViewState extends State<SpaceView> {
_loadHierarchy();
}
void _showSpaceChildEditMenu(BuildContext posContext, String roomId) async {
Future<void> _showSpaceChildEditMenu(
BuildContext posContext,
String roomId,
) async {
final overlay =
Overlay.of(posContext).context.findRenderObject() as RenderBox;

View file

@ -29,7 +29,7 @@ class ChatMembersController extends State<ChatMembersPage> {
setFilter();
}
void setFilter([_]) async {
Future<void> setFilter([_]) async {
final filter = filterController.text.toLowerCase().trim();
final members = this.members
@ -56,7 +56,7 @@ class ChatMembersController extends State<ChatMembersPage> {
});
}
void refreshMembers([_]) async {
Future<void> refreshMembers([_]) async {
Logs().d('Load room members from', widget.roomId);
try {
setState(() {

View file

@ -21,7 +21,7 @@ class ChatPermissionsSettings extends StatefulWidget {
class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
String? get roomId => GoRouterState.of(context).pathParameters['roomid'];
void editPowerLevel(
Future<void> editPowerLevel(
BuildContext context,
String key,
int currentLevel, {

View file

@ -44,7 +44,7 @@ class ChatSearchController extends State<ChatSearchPage>
});
}
void startSearch() async {
Future<void> startSearch() async {
switch (tabController.index) {
case 0:
final searchQuery = searchController.text.trim();

View file

@ -38,7 +38,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
super.initState();
}
void _checkChatBackup() async {
Future<void> _checkChatBackup() async {
final client = Matrix.of(context).client;
final state = await client.getCryptoIdentityState();
setState(() {
@ -46,7 +46,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
});
}
void removeDevicesAction(List<Device> devices) async {
Future<void> removeDevicesAction(List<Device> devices) async {
final client = Matrix.of(context).client;
final wellKnown = await client.getWellknown();
@ -84,7 +84,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
reload();
}
void renameDeviceAction(Device device) async {
Future<void> renameDeviceAction(Device device) async {
final displayName = await showTextInputDialog(
context: context,
title: L10n.of(context).changeDeviceName,
@ -104,7 +104,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
}
}
void verifyDeviceAction(Device device) async {
Future<void> verifyDeviceAction(Device device) async {
final consent = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).verifyOtherDevice,
@ -129,7 +129,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
await KeyVerificationDialog(request: req).show(context);
}
void blockDeviceAction(Device device) async {
Future<void> blockDeviceAction(Device device) async {
final key = Matrix.of(context)
.client
.userDeviceKeys[Matrix.of(context).client.userID!]!
@ -141,7 +141,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
setState(() {});
}
void unblockDeviceAction(Device device) async {
Future<void> unblockDeviceAction(Device device) async {
final key = Matrix.of(context)
.client
.userDeviceKeys[Matrix.of(context).client.userID!]!

View file

@ -171,7 +171,7 @@ class MyCallingPage extends State<Calling> {
EdgeInsetsGeometry? _localVideoMargin;
CallState? _state;
void _playCallSound() async {
Future<void> _playCallSound() async {
const path = 'assets/sounds/call.ogg';
if (kIsWeb || PlatformInfos.isMobile || PlatformInfos.isMacOS) {
final player = AudioPlayer();
@ -245,7 +245,7 @@ class MyCallingPage extends State<Calling> {
}
void _handleCallState(CallState state) {
Logs().v('CallingPage::handleCallState: ${state.toString()}');
Logs().v('CallingPage::handleCallState: $state');
if ({CallState.kConnected, CallState.kEnded}.contains(state)) {
HapticFeedback.heavyImpact();
}
@ -322,7 +322,7 @@ class MyCallingPage extends State<Calling> {
});
}
void _switchCamera() async {
Future<void> _switchCamera() async {
if (call.localUserMediaStream != null) {
await Helper.switchCamera(
call.localUserMediaStream!.stream!.getVideoTracks().first,

View file

@ -67,7 +67,7 @@ class ImageViewerController extends State<ImageViewer> {
}
}
void prevImage() async {
Future<void> prevImage() async {
await pageController.previousPage(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
@ -76,7 +76,7 @@ class ImageViewerController extends State<ImageViewer> {
setState(() {});
}
void nextImage() async {
Future<void> nextImage() async {
await pageController.nextPage(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,

View file

@ -35,7 +35,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
final _supportsVideoPlayer =
!PlatformInfos.isWindows && !PlatformInfos.isLinux;
void _downloadAction() async {
Future<void> _downloadAction() async {
if (!_supportsVideoPlayer) {
widget.event.saveFile(context);
return;

View file

@ -35,7 +35,7 @@ class _IntroPagePresenterState extends State<IntroPagePresenter> {
if (kIsWeb) _finishOidcLogin();
}
void _finishOidcLogin() async {
Future<void> _finishOidcLogin() async {
final store = await SharedPreferences.getInstance();
final storedHomeserverString = store.getString(
OidcSessionJsonExtension.homeserverStoreKey,

View file

@ -50,7 +50,11 @@ class InvitationSelectionController extends State<InvitationSelection> {
return contacts;
}
void inviteAction(BuildContext context, String id, String displayname) async {
Future<void> inviteAction(
BuildContext context,
String id,
String displayname,
) async {
final room = Matrix.of(context).client.getRoomById(roomId!)!;
final success = await showFutureLoadingDialog(
@ -74,7 +78,7 @@ class InvitationSelectionController extends State<InvitationSelection> {
);
}
void searchUser(BuildContext context, String text) async {
Future<void> searchUser(BuildContext context, String text) async {
coolDown?.cancel();
if (text.isEmpty) {
setState(() => foundProfiles = []);

View file

@ -32,7 +32,7 @@ class LoginController extends State<Login> {
void toggleShowPassword() =>
setState(() => showPassword = !loading && !showPassword);
void login() async {
Future<void> login() async {
final matrix = Matrix.of(context);
if (usernameController.text.isEmpty) {
setState(() => usernameError = L10n.of(context).pleaseEnterYourUsername);
@ -102,7 +102,7 @@ class LoginController extends State<Login> {
);
}
void _checkWellKnown(String userId) async {
Future<void> _checkWellKnown(String userId) async {
if (mounted) setState(() => usernameError = null);
if (!userId.isValidMatrixId) return;
final oldHomeserver = widget.client.homeserver;
@ -158,7 +158,7 @@ class LoginController extends State<Login> {
}
}
void passwordForgotten() async {
Future<void> passwordForgotten() async {
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,

View file

@ -47,7 +47,7 @@ class NewGroupController extends State<NewGroup> {
void setGroupCanBeFound(bool b) => setState(() => groupCanBeFound = b);
void selectPhoto() async {
Future<void> selectPhoto() async {
final photo = await selectFiles(
context,
type: FileType.image,
@ -108,7 +108,7 @@ class NewGroupController extends State<NewGroup> {
context.pop<String>(spaceId);
}
void submitAction([_]) async {
Future<void> submitAction([_]) async {
final client = Matrix.of(context).client;
try {

View file

@ -33,7 +33,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
static const Duration _coolDown = Duration(milliseconds: 500);
void searchUsers([String? input]) async {
Future<void> searchUsers([String? input]) async {
final searchTerm = input ?? controller.text;
if (searchTerm.isEmpty) {
_searchCoolDown?.cancel();
@ -68,7 +68,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
void inviteAction() => FluffyShare.shareInviteLink(context);
void openScannerAction() async {
Future<void> openScannerAction() async {
if (PlatformInfos.isAndroid) {
final info = await DeviceInfoPlugin().androidInfo;
if (info.version.sdkInt < 21) {
@ -88,7 +88,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
);
}
void copyUserId() async {
Future<void> copyUserId() async {
await Clipboard.setData(
ClipboardData(text: Matrix.of(context).client.userID!),
);

View file

@ -35,7 +35,7 @@ class SettingsController extends State<Settings> {
profileFuture = null;
});
void setDisplaynameAction() async {
Future<void> setDisplaynameAction() async {
final profile = await profileFuture;
final input = await showTextInputDialog(
useRootNavigator: false,
@ -61,7 +61,7 @@ class SettingsController extends State<Settings> {
}
}
void logoutAction() async {
Future<void> logoutAction() async {
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
@ -81,7 +81,7 @@ class SettingsController extends State<Settings> {
);
}
void setAvatarAction() async {
Future<void> setAvatarAction() async {
final profile = await profileFuture;
final actions = [
if (PlatformInfos.isMobile)
@ -159,7 +159,7 @@ class SettingsController extends State<Settings> {
super.initState();
}
void checkBootstrap() async {
Future<void> checkBootstrap() async {
final client = Matrix.of(context).client;
if (!client.encryptionEnabled) return;
await client.accountDataLoading;
@ -176,7 +176,7 @@ class SettingsController extends State<Settings> {
bool? cryptoIdentityConnected;
void firstRunBootstrapAction([_]) async {
Future<void> firstRunBootstrapAction([_]) async {
if (cryptoIdentityConnected == true) {
showOkAlertDialog(
context: context,

View file

@ -19,7 +19,7 @@ class Settings3Pid extends StatefulWidget {
}
class Settings3PidController extends State<Settings3Pid> {
void add3PidAction() async {
Future<void> add3PidAction() async {
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
@ -63,7 +63,7 @@ class Settings3PidController extends State<Settings3Pid> {
Future<List<ThirdPartyIdentifier>?>? request;
void delete3Pid(ThirdPartyIdentifier identifier) async {
Future<void> delete3Pid(ThirdPartyIdentifier identifier) async {
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,

View file

@ -245,7 +245,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
});
}
void createImagePack() async {
Future<void> createImagePack() async {
final room = this.room;
if (room == null) throw Exception('Cannot create image pack without room');
@ -287,14 +287,14 @@ class EmotesSettingsController extends State<EmotesSettings> {
setState(() {});
}
void saveAction() async {
Future<void> saveAction() async {
await save(context);
setState(() {
showSave = false;
});
}
void createStickers() async {
Future<void> createStickers() async {
final pickedFiles = await selectFiles(
context,
type: FileType.image,

View file

@ -26,7 +26,7 @@ class SettingsNotifications extends StatefulWidget {
class SettingsNotificationsController extends State<SettingsNotifications> {
bool isLoading = false;
void onPusherTap(Pusher pusher) async {
Future<void> onPusherTap(Pusher pusher) async {
final delete = await showModalActionPopup<bool>(
context: context,
title: pusher.deviceDisplayName,
@ -58,7 +58,7 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
Future<List<Pusher>?>? pusherFuture;
void togglePushRule(PushRuleKind kind, PushRule pushRule) async {
Future<void> togglePushRule(PushRuleKind kind, PushRule pushRule) async {
setState(() {
isLoading = true;
});
@ -91,7 +91,7 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
}
}
void editPushRule(PushRule rule, PushRuleKind kind) async {
Future<void> editPushRule(PushRule rule, PushRuleKind kind) async {
final theme = Theme.of(context);
final action = await showAdaptiveDialog<PushRuleDialogAction>(
context: context,

View file

@ -25,7 +25,7 @@ class SettingsPasswordController extends State<SettingsPassword> {
bool loading = false;
void changePassword() async {
Future<void> changePassword() async {
setState(() {
oldPasswordError = newPassword1Error = newPassword2Error = null;
});

View file

@ -19,7 +19,7 @@ class SettingsSecurity extends StatefulWidget {
}
class SettingsSecurityController extends State<SettingsSecurity> {
void setAppLockAction() async {
Future<void> setAppLockAction() async {
if (AppLock.of(context).isActive) {
AppLock.of(context).showLockScreen();
}
@ -46,7 +46,7 @@ class SettingsSecurityController extends State<SettingsSecurity> {
}
}
void deleteAccountAction() async {
Future<void> deleteAccountAction() async {
if (await showOkCancelAlertDialog(
useRootNavigator: false,
context: context,
@ -93,7 +93,7 @@ class SettingsSecurityController extends State<SettingsSecurity> {
Future<void> dehydrateAction() => Matrix.of(context).dehydrateAction(context);
void changeShareKeysWith(ShareKeysWith? shareKeysWith) async {
Future<void> changeShareKeysWith(ShareKeysWith? shareKeysWith) async {
if (shareKeysWith == null) return;
AppSettings.shareKeysWith.setItem(shareKeysWith.name);
Matrix.of(context).client.shareKeysWith = shareKeysWith;

View file

@ -26,7 +26,7 @@ class SettingsStyleController extends State<SettingsStyle> {
ThemeController.of(context).setPrimaryColor(color);
}
void setWallpaper() async {
Future<void> setWallpaper() async {
final client = Matrix.of(context).client;
final picked = await selectFiles(context, type: FileType.image);
final pickedFile = picked.firstOrNull;
@ -53,7 +53,7 @@ class SettingsStyleController extends State<SettingsStyle> {
double? _wallpaperOpacity;
void saveWallpaperOpacity(double opacity) async {
Future<void> saveWallpaperOpacity(double opacity) async {
final client = Matrix.of(context).client;
final result = await showFutureLoadingDialog(
context: context,
@ -80,7 +80,7 @@ class SettingsStyleController extends State<SettingsStyle> {
0.5;
double? _wallpaperBlur;
void saveWallpaperBlur(double blur) async {
Future<void> saveWallpaperBlur(double blur) async {
final client = Matrix.of(context).client;
final result = await showFutureLoadingDialog(
context: context,
@ -153,7 +153,7 @@ class SettingsStyleController extends State<SettingsStyle> {
setState(() {});
}
void changeFontSizeFactor(double d) async {
Future<void> changeFontSizeFactor(double d) async {
await AppSettings.fontSizeFactor.setItem(d);
setState(() {});
}

View file

@ -201,7 +201,7 @@ class SettingsStyleView extends StatelessWidget {
type: EventTypes.RoomMember,
senderId: client.userID!,
originServerTs: DateTime.now(),
stateKey: client.userID!,
stateKey: client.userID,
),
),
Padding(

View file

@ -52,7 +52,7 @@ class SignInViewModel extends ValueNotifier<SignInState> {
);
}
void refreshPublicHomeservers() async {
Future<void> refreshPublicHomeservers() async {
value = value.copyWith(publicHomeservers: AsyncSnapshot.waiting());
final defaultHomeserverData = PublicHomeserverData(
name: AppSettings.defaultHomeserver.value,

View file

@ -72,7 +72,7 @@ class BackgroundPush {
bool upAction = false;
void _init() async {
Future<void> _init() async {
//<GOOGLE_SERVICES>firebaseEnabled = true;
try {
mainIsolateReceivePort?.listen((message) async {

View file

@ -22,7 +22,7 @@ extension ClientDownloadContentExtension on Client {
width: width,
height: height,
animated: animated,
method: thumbnailMethod!,
method: thumbnailMethod,
)
: mxc;

View file

@ -145,7 +145,7 @@ abstract class ClientManager {
);
}
static void sendInitNotification(String title, String body) async {
static Future<void> sendInitNotification(String title, String body) async {
if (kIsWeb) {
html.Notification(title, body: body);
return;

View file

@ -22,14 +22,14 @@ class ErrorReporter {
'HandshakeException',
};
void onErrorCallback(Object error, [StackTrace? stackTrace]) {
Future<void> onErrorCallback(Object error, [StackTrace? stackTrace]) async {
if (ingoredTypes.contains(error.runtimeType.toString())) return;
Logs().e(message ?? 'Error caught', error, stackTrace);
final text = '$error\n${stackTrace ?? ''}';
return _onErrorCallback(text);
}
void _onErrorCallback(String text) async {
Future<void> _onErrorCallback(String text) async {
await showAdaptiveDialog(
context: context!,
builder: (context) => AlertDialog.adaptive(

View file

@ -56,7 +56,7 @@ class MarkdownContextBuilder extends StatelessWidget {
controller.text = controller.text.replaceRange(
selection.start,
selection.end,
'[$selectedText](${url.toString()})',
'[$selectedText]($url)',
);
ContextMenuController.removeAny();
},

View file

@ -26,13 +26,13 @@ extension LocalizedBody on Event {
},
);
void saveFile(BuildContext context) async {
Future<void> saveFile(BuildContext context) async {
final matrixFile = await _getFile(context);
matrixFile.result?.save(context);
}
void shareFile(BuildContext context) async {
Future<void> shareFile(BuildContext context) async {
final matrixFile = await _getFile(context);
inspect(matrixFile);

View file

@ -47,7 +47,7 @@ Future<String?> getDatabaseCipher() async {
return password;
}
void _sendNoEncryptionWarning(Object exception) async {
Future<void> _sendNoEncryptionWarning(Object exception) async {
final isStored = AppSettings.noEncryptionWarningShown.value;
if (isStored == true) return;

View file

@ -8,7 +8,7 @@ import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/size_string.dart';
extension MatrixFileExtension on MatrixFile {
void save(BuildContext context) async {
Future<void> save(BuildContext context) async {
final scaffoldMessenger = ScaffoldMessenger.of(context);
final l10n = L10n.of(context);
final downloadPath = await FilePicker.platform.saveFile(
@ -31,7 +31,7 @@ extension MatrixFileExtension on MatrixFile {
return FileType.any;
}
void share(BuildContext context) async {
Future<void> share(BuildContext context) async {
// Workaround for iPad from
// https://github.com/fluttercommunity/plus_plugins/tree/main/packages/share_plus/share_plus#ipad
final box = context.findRenderObject() as RenderBox?;

View file

@ -53,7 +53,7 @@ Future<void> waitForPushIsolateDone() async {
}
@pragma('vm:entry-point')
void notificationTapBackground(
Future<void> notificationTapBackground(
NotificationResponse notificationResponse,
) async {
final sendPort = IsolateNameServer.lookupPortByName(

View file

@ -47,7 +47,7 @@ abstract class PlatformInfos {
return version;
}
static void showDialog(BuildContext context) async {
static Future<void> showDialog(BuildContext context) async {
final version = await PlatformInfos.getVersion();
showAboutDialog(
context: context,

View file

@ -10,7 +10,7 @@ import 'package:fluffychat/utils/platform_infos.dart';
abstract class UpdateNotifier {
static const String versionStoreKey = 'last_known_version';
static void showUpdateSnackBar(BuildContext context) async {
static Future<void> showUpdateSnackBar(BuildContext context) async {
final scaffoldMessenger = ScaffoldMessenger.of(context);
final currentVersion = await PlatformInfos.getVersion();
final store = await SharedPreferences.getInstance();

View file

@ -13,7 +13,7 @@ import 'package:fluffychat/utils/sign_in_flows/sso_login.dart';
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
import 'package:fluffychat/widgets/matrix.dart';
void connectToHomeserverFlow(
Future<void> connectToHomeserverFlow(
PublicHomeserverData homeserverData,
BuildContext context,
void Function(AsyncSnapshot<bool>) setState,

View file

@ -7,15 +7,15 @@ extension SizeString on num {
if (size < 1000 * 1000) {
size = size / 1000;
size = (size * 10).round() / 10;
return '${size.toString()} KB';
return '$size KB';
}
if (size < 1000 * 1000 * 1000) {
size = size / 1000000;
size = (size * 10).round() / 10;
return '${size.toString()} MB';
return '$size MB';
}
size = size / 1000 * 1000 * 1000 * 1000;
size = (size * 10).round() / 10;
return '${size.toString()} GB';
return '$size GB';
}
}

View file

@ -27,7 +27,7 @@ class UrlLauncher {
const UrlLauncher(this.context, this.url, [this.name]);
void launchUrl() async {
Future<void> launchUrl() async {
if (url!.toLowerCase().startsWith(AppConfig.deepLinkPrefix) ||
url!.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) ||
{'#', '@', '!', '+', '\$'}.contains(url![0]) ||
@ -117,7 +117,7 @@ class UrlLauncher {
);
}
void openMatrixToUrl() async {
Future<void> openMatrixToUrl() async {
final matrix = Matrix.of(context);
final url = this.url!.replaceFirst(
AppConfig.deepLinkPrefix,

View file

@ -23,7 +23,7 @@ class PublicRoomDialog extends StatelessWidget {
const PublicRoomDialog({super.key, this.roomAlias, this.chunk, this.via});
void _joinRoom(BuildContext context) async {
Future<void> _joinRoom(BuildContext context) async {
final client = Matrix.of(context).client;
final chunk = this.chunk;
final knock = chunk?.joinRule == 'knock';

View file

@ -41,7 +41,7 @@ class AppLock extends State<AppLockWidget> with WidgetsBindingObserver {
WidgetsBinding.instance.addPostFrameCallback(_checkLoggedIn);
}
void _checkLoggedIn(_) async {
Future<void> _checkLoggedIn(_) async {
if (widget.clients.any((client) => client.isLogged())) return;
await changePincode(null);

View file

@ -16,7 +16,7 @@ class ConfigViewer extends StatefulWidget {
}
class _ConfigViewerState extends State<ConfigViewer> {
void _changeSetting(
Future<void> _changeSetting(
AppSettings appSetting,
SharedPreferences store,
String initialValue,

View file

@ -22,7 +22,7 @@ extension LocalNotificationsExtension on MatrixState {
..src = 'assets/assets/sounds/notification.ogg'
..load();
void showLocalNotification(Event event) async {
Future<void> showLocalNotification(Event event) async {
final roomId = event.room.id;
if (activeRoomId == roomId) {
if (WidgetsBinding.instance.lifecycleState == AppLifecycleState.resumed) {

View file

@ -20,7 +20,7 @@ class _LockScreenState extends State<LockScreen> {
bool _inputBlocked = false;
final TextEditingController _textEditingController = TextEditingController();
void tryUnlock(String text) async {
Future<void> tryUnlock(String text) async {
text = text.trim();
setState(() {
_errorText = null;

View file

@ -81,10 +81,10 @@ extension on LogEvent {
String toDisplayString() {
var str = '# [${level.toString().split('.').last.toUpperCase()}] $title';
if (exception != null) {
str += ' - ${exception.toString()}';
str += ' - $exception';
}
if (stackTrace != null) {
str += '\n${stackTrace.toString()}';
str += '\n$stackTrace';
}
return str;
}

View file

@ -342,7 +342,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
createVoipPlugin();
}
void createVoipPlugin() async {
Future<void> createVoipPlugin() async {
if (AppSettings.experimentalVoip.value) {
voipPlugin = null;
return;

View file

@ -10,7 +10,7 @@ import 'adaptive_dialogs/user_dialog.dart';
import 'avatar.dart';
import 'future_loading_dialog.dart';
void showMemberActionsPopupMenu({
Future<void> showMemberActionsPopupMenu({
required BuildContext context,
required User user,
void Function()? onMention,

View file

@ -109,7 +109,7 @@ class _MxcImageState extends State<MxcImage> {
}
}
void _tryLoad() async {
Future<void> _tryLoad() async {
if (_imageData != null) {
return;
}

View file

@ -24,7 +24,7 @@ class QrCodeViewer extends StatelessWidget {
const QrCodeViewer({required this.content, super.key});
void _save(BuildContext context) async {
Future<void> _save(BuildContext context) async {
final imageResult = await showFutureLoadingDialog(
context: context,
future: () {

View file

@ -48,7 +48,7 @@ class _ShareScaffoldDialogState extends State<ShareScaffoldDialog> {
});
}
void _forwardAction() async {
Future<void> _forwardAction() async {
final roomId = selectedRoomId;
if (roomId == null) {
throw Exception(

View file

@ -41,7 +41,7 @@ class ThemeController extends State<ThemeBuilder> {
static ThemeController of(BuildContext context) =>
Provider.of<ThemeController>(context, listen: false);
void _loadData(_) async {
Future<void> _loadData(_) async {
final preferences = _sharedPreferences ??=
await SharedPreferences.getInstance();