refactor: Clean up new dart version lints

This commit is contained in:
Christian Kußowski 2025-05-26 12:09:31 +02:00
parent 72768af5ad
commit b94677240b
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652
7 changed files with 13 additions and 11 deletions

View File

@ -26,7 +26,6 @@ linter:
throw_in_finally: true throw_in_finally: true
unawaited_futures: true unawaited_futures: true
unnecessary_statements: true unnecessary_statements: true
unsafe_html: true
# Readability & Style # Readability & Style
# These are opinionated choices, where Dart gives us 2 ways to express the same thing. # These are opinionated choices, where Dart gives us 2 ways to express the same thing.

View File

@ -84,6 +84,7 @@ class FakeMatrixApi extends BaseClient {
StreamSubscription<String>? sub; StreamSubscription<String>? sub;
sub = currentApi!._apiCallStream.stream.listen((action) { sub = currentApi!._apiCallStream.stream.listen((action) {
if (test(action)) { if (test(action)) {
// ignore: discarded_futures
sub?.cancel(); sub?.cancel();
completer.complete(action); completer.complete(action);
} }

View File

@ -2245,7 +2245,7 @@ class Client extends MatrixApi {
_currentSync ??= _innerSync(timeout: timeout).whenComplete(() { _currentSync ??= _innerSync(timeout: timeout).whenComplete(() {
_currentSync = null; _currentSync = null;
if (_backgroundSync && isLogged() && !_disposed) { if (_backgroundSync && isLogged() && !_disposed) {
_sync(); unawaited(_sync());
} }
}); });
return currentSync; return currentSync;

View File

@ -288,7 +288,7 @@ class CallSession {
Logs().v('[VOIP] Call invite has expired. Hanging up.'); Logs().v('[VOIP] Call invite has expired. Hanging up.');
fireCallEvent(CallStateChange.kHangup); fireCallEvent(CallStateChange.kHangup);
hangup(reason: CallErrorCode.inviteTimeout); unawaited(hangup(reason: CallErrorCode.inviteTimeout));
} }
_ringingTimer?.cancel(); _ringingTimer?.cancel();
_ringingTimer = null; _ringingTimer = null;
@ -1117,7 +1117,7 @@ class CallSession {
_inviteTimer = Timer(CallTimeouts.callInviteLifetime, () { _inviteTimer = Timer(CallTimeouts.callInviteLifetime, () {
if (state == CallState.kInviteSent) { if (state == CallState.kInviteSent) {
hangup(reason: CallErrorCode.inviteTimeout); unawaited(hangup(reason: CallErrorCode.inviteTimeout));
} }
_inviteTimer?.cancel(); _inviteTimer?.cancel();
_inviteTimer = null; _inviteTimer = null;
@ -1173,7 +1173,7 @@ class CallSession {
final delay = direction == CallDirection.kIncoming ? 500 : 2000; final delay = direction == CallDirection.kIncoming ? 500 : 2000;
if (_candidateSendTries == 0) { if (_candidateSendTries == 0) {
Timer(Duration(milliseconds: delay), () { Timer(Duration(milliseconds: delay), () {
_sendCandidateQueue(); unawaited(_sendCandidateQueue());
}); });
} }
}; };
@ -1424,7 +1424,7 @@ class CallSession {
final delay = 500 * pow(2, _candidateSendTries); final delay = 500 * pow(2, _candidateSendTries);
Timer(Duration(milliseconds: delay as int), () { Timer(Duration(milliseconds: delay as int), () {
_sendCandidateQueue(); unawaited(_sendCandidateQueue());
}); });
} }
} }

View File

@ -24,12 +24,12 @@ class ConnectionTester {
pc1!.onIceCandidate = (candidate) { pc1!.onIceCandidate = (candidate) {
if (candidate.candidate!.contains('relay')) { if (candidate.candidate!.contains('relay')) {
pc2!.addCandidate(candidate); unawaited(pc2!.addCandidate(candidate));
} }
}; };
pc2!.onIceCandidate = (candidate) { pc2!.onIceCandidate = (candidate) {
if (candidate.candidate!.contains('relay')) { if (candidate.candidate!.contains('relay')) {
pc1!.addCandidate(candidate); unawaited(pc1!.addCandidate(candidate));
} }
}; };

View File

@ -783,7 +783,7 @@ class VoIP {
currentCID = VoipId(roomId: roomId, callId: callId); currentCID = VoipId(roomId: roomId, callId: callId);
await newCall.initOutboundCall(type).then((_) { await newCall.initOutboundCall(type).then((_) {
delegate.handleNewCall(newCall); unawaited(delegate.handleNewCall(newCall));
}); });
return newCall; return newCall;
} }

View File

@ -30,7 +30,9 @@ class User {
const User(this.name, this.password); const User(this.name, this.password);
} }
const homeserver = 'http://${const String.fromEnvironment( const _homeserverFromEnv = String.fromEnvironment(
'HOMESERVER', 'HOMESERVER',
defaultValue: 'localhost', defaultValue: 'localhost',
)}'; );
const homeserver = 'http://$_homeserverFromEnv';