refactor: Enable rule avoid dynamic

This commit is contained in:
Christian Kußowski 2026-02-19 08:42:35 +01:00
commit 9d007815df
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
17 changed files with 41 additions and 35 deletions

View file

@ -117,9 +117,9 @@ class ChatController extends State<ChatPageWithRoom>
bool currentlyTyping = false;
bool dragging = false;
void onDragEntered(dynamic _) => setState(() => dragging = true);
void onDragEntered(_) => setState(() => dragging = true);
void onDragExited(dynamic _) => setState(() => dragging = false);
void onDragExited(_) => setState(() => dragging = false);
void onDragDone(DropDoneDetails details) async {
setState(() => dragging = false);
@ -213,7 +213,7 @@ class ChatController extends State<ChatPageWithRoom>
context.go('/rooms');
}
void requestHistory([dynamic _]) async {
void requestHistory([_]) async {
Logs().v('Requesting history...');
await timeline?.requestHistory(historyCount: _loadHistoryCount);
}
@ -265,7 +265,7 @@ class ChatController extends State<ChatPageWithRoom>
}
}
void _shareItems([dynamic _]) {
void _shareItems([_]) {
final shareItems = widget.shareItems;
if (shareItems == null || shareItems.isEmpty) return;
if (!room.otherPartyCanReceiveMessages) {
@ -1053,7 +1053,7 @@ class ChatController extends State<ChatPageWithRoom>
scrollController.jumpTo(0);
}
void onEmojiSelected(dynamic _, Emoji? emoji) {
void onEmojiSelected(_, Emoji? emoji) {
typeEmoji(emoji);
onInputBarChanged(sendController.text);
}

View file

@ -151,7 +151,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
setState(() => status = AudioPlayerStatus.downloading);
try {
final fileSize = widget.event.content
.tryGetMap<String, dynamic>('info')
.tryGetMap<String, Object?>('info')
?.tryGet<int>('size');
matrixFile = await widget.event.downloadAndDecryptAttachment(
onDownloadProgress: fileSize != null && fileSize > 0
@ -242,7 +242,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
List<int>? _getWaveform() {
final eventWaveForm = widget.event.content
.tryGetMap<String, dynamic>('org.matrix.msc1767.audio')
.tryGetMap<String, Object?>('org.matrix.msc1767.audio')
?.tryGetList<int>('waveform');
if (eventWaveForm == null || eventWaveForm.isEmpty) {
return null;
@ -275,7 +275,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
}
final durationInt = widget.event.content
.tryGetMap<String, dynamic>('info')
.tryGetMap<String, Object?>('info')
?.tryGet<int>('duration');
if (durationInt != null) {
final duration = Duration(milliseconds: durationInt);

View file

@ -27,7 +27,7 @@ class MessageDownloadContent extends StatelessWidget {
final filetype = (filename.contains('.')
? filename.split('.').last.toUpperCase()
: event.content
.tryGetMap<String, dynamic>('info')
.tryGetMap<String, Object?>('info')
?.tryGet<String>('mimetype')
?.toUpperCase() ??
'UNKNOWN');

View file

@ -26,7 +26,7 @@ class MessageReactions extends StatelessWidget {
for (final e in allReactionEvents) {
final key = e.content
.tryGetMap<String, dynamic>('m.relates_to')
.tryGetMap<String, Object?>('m.relates_to')
?.tryGet<String>('key');
if (key != null) {
if (!reactionMap.containsKey(key)) {

View file

@ -56,7 +56,7 @@ class _StartPollBottomSheetState extends State<StartPollBottomSheet> {
}
}
void _updateCanCreate([dynamic _]) {
void _updateCanCreate([_]) {
final newCanCreate =
_bodyController.text.trim().isNotEmpty &&
!_answers.any((controller) => controller.text.trim().isEmpty);

View file

@ -30,7 +30,7 @@ class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
}
}
void enableEncryption(dynamic _) async {
void enableEncryption(_) async {
if (room.encrypted) {
showOkAlertDialog(
context: context,

View file

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

View file

@ -49,7 +49,7 @@ class ChatSearchFilesTab extends StatelessWidget {
final filetype = (filename.contains('.')
? filename.split('.').last.toUpperCase()
: event.content
.tryGetMap<String, dynamic>('info')
.tryGetMap<String, Object?>('info')
?.tryGet<String>('mimetype')
?.toUpperCase() ??
'UNKNOWN');

View file

@ -105,7 +105,7 @@ class PIPViewState extends State<PIPView> with TickerProviderStateMixin {
});
}
void _onPanEnd(dynamic _) {
void _onPanEnd(_) {
if (!_isDragging) return;
final nearestCorner = _calculateNearestCorner(
@ -122,7 +122,7 @@ class PIPViewState extends State<PIPView> with TickerProviderStateMixin {
});
}
void _onPanStart(dynamic _) {
void _onPanStart(_) {
if (_isAnimating()) return;
setState(() {
_dragOffset = _offsets[_corner]!;

View file

@ -43,7 +43,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
try {
final fileSize = widget.event.content
.tryGetMap<String, dynamic>('info')
.tryGetMap<String, Object?>('info')
?.tryGet<int>('size');
final videoFile = await widget.event.downloadAndDecryptAttachment(
onDownloadProgress: fileSize == null

View file

@ -108,7 +108,7 @@ class NewGroupController extends State<NewGroup> {
context.pop<String>(spaceId);
}
void submitAction([dynamic _]) async {
void submitAction([_]) async {
final client = Matrix.of(context).client;
try {

View file

@ -182,7 +182,7 @@ class SettingsController extends State<Settings> {
bool? crossSigningCached;
bool? showChatBackupBanner;
void firstRunBootstrapAction([dynamic _]) async {
void firstRunBootstrapAction([_]) async {
if (showChatBackupBanner != true) {
showOkAlertDialog(
context: context,

View file

@ -59,7 +59,7 @@ extension LocalizedBody on Event {
(content['url'] is String));
String? get sizeString => content
.tryGetMap<String, dynamic>('info')
.tryGetMap<String, Object?>('info')
?.tryGet<int>('size')
?.sizeString;
}

View file

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

View file

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