refactor: Fix new lints from flutter 3.27

This commit is contained in:
Krille 2024-12-15 12:21:26 +01:00
parent 168433a709
commit 04a46226cb
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652
10 changed files with 24 additions and 11 deletions

View File

@ -27,7 +27,9 @@ extension JsonSignatureCheckExtension on Map<String, dynamic> {
final signatures = this['signatures'];
if (signatures == null ||
signatures is! Map<String, dynamic> ||
!signatures.containsKey(userId)) return false;
!signatures.containsKey(userId)) {
return false;
}
remove('unsigned');
remove('signatures');
if (!signatures[userId].containsKey('ed25519:$deviceId')) return false;

View File

@ -54,7 +54,9 @@ extension DehydratedDeviceHandler on Client {
// Only handle devices we understand
// In the future we might want to migrate to a newer format here
if (device.deviceData?.tryGet<String>('algorithm') !=
_dehydratedDeviceAlgorithm) return;
_dehydratedDeviceAlgorithm) {
return;
}
// Verify that the device is cross-signed
final dehydratedDeviceIdentity =

View File

@ -2567,7 +2567,9 @@ class Client extends MatrixApi {
if (event.event.roomID != roomId) continue;
if (!sessionIds.contains(
event.event.content['content']?['session_id'],
)) continue;
)) {
continue;
}
final decryptedEvent = await event.event.decrypt(room);
if (decryptedEvent.content.tryGet<String>('type') !=

View File

@ -115,7 +115,9 @@ class ReceiptEventContent {
if (userId is! String ||
!userId.isValidMatrixId ||
receiptContent is! Map) continue;
receiptContent is! Map) {
continue;
}
final ts = receiptContent['ts'];
final threadId = receiptContent['thread_id'];

View File

@ -518,7 +518,9 @@ class Room {
// There is no known event or the last event is only a state fallback event,
// we assume there is no new messages.
if (lastEvent == null ||
!client.roomPreviewLastEvents.contains(lastEvent.type)) return false;
!client.roomPreviewLastEvents.contains(lastEvent.type)) {
return false;
}
// Read marker is on the last event so no new messages.
if (lastEvent.receipts

View File

@ -263,7 +263,9 @@ class Timeline {
if (!allowNewEvent) {
if (resp.start == resp.end ||
(resp.end == null && direction == Direction.f)) allowNewEvent = true;
(resp.end == null && direction == Direction.f)) {
allowNewEvent = true;
}
if (allowNewEvent) {
Logs().d('We now allow sync update into the timeline.');
@ -566,7 +568,9 @@ class Timeline {
events.indexWhere(
(e) => e.eventId == eventUpdate.content['event_id'],
) !=
-1) return;
-1) {
return;
}
var index = events.length;
if (eventUpdate.type == EventUpdateType.history) {
events.add(newEvent);

View File

@ -203,7 +203,6 @@ abstract class EventLocalizations {
case RoomMemberChangeType.knock:
return i18n.hasKnocked(targetName);
case RoomMemberChangeType.other:
default:
return userIsTarget
? i18n.youJoinedTheChat
: i18n.joinedTheChat(targetName);

View File

@ -153,7 +153,6 @@ class _MemberCountCondition {
case _CountComparisonOp.lt:
return memberCount < count;
case _CountComparisonOp.eq:
default:
return memberCount == count;
}
}

View File

@ -650,7 +650,6 @@ class MeshBackend extends CallBackend {
await call.setLocalVideoMuted(muted);
}
break;
default:
}
}

View File

@ -1016,7 +1016,9 @@ class CallSession {
// when a call crash and this call is already terminated the currentCId is null.
// So don't return bc the hangup or reject will not proceed anymore.
if (voip.currentCID != null &&
voip.currentCID != VoipId(roomId: room.id, callId: callId)) return;
voip.currentCID != VoipId(roomId: room.id, callId: callId)) {
return;
}
voip.currentCID = null;
voip.incomingCallRoomId.removeWhere((key, value) => value == callId);
}