Skip to content

Commit 49e83b3

Browse files
Brazoldeven98
andauthored
chore: fixed analysis errors (#516)
* fixed analysis errors * tweaks --------- Co-authored-by: Deven Joshi <[email protected]>
1 parent 55c199a commit 49e83b3

File tree

86 files changed

+343
-566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+343
-566
lines changed

analysis_options.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ analyzer:
1010
# We explicitly enabled even conflicting rules and are fixing the conflict
1111
# in this file.
1212
included_file_warning: ignore
13+
14+
todo: ignore
1315
exclude:
1416
# exclude all the generated files
1517
- packages/*/lib/**/*.*.dart
@@ -89,4 +91,10 @@ linter:
8991

9092
# Not a common style and would add a lot of verbosity to function signature.
9193
# 'parameter_assignments' already enforces this to an extent.
92-
prefer_final_parameters: false
94+
prefer_final_parameters: false
95+
96+
# There are situations where we use default in enums on purpose
97+
no_default_cases: false
98+
99+
# Would be a breaking change in some cases, no need to add those just for lintl cleanup
100+
avoid_positional_boolean_parameters: false

development.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
- [ ] Regular reconnection [Maciej,Kanat]
4646
- [ ] Support ICE restart reconnection [Maciej,Kanat]
4747
- [ ] Update WebRTC version to m114 (livekit version) [Kanat]
48-
- [ ] Fix analysis issues [Maciej]
48+
- [x] Fix analysis issues [Maciej]
4949

5050
### 0.4.0 milestone
5151
- [ ] Implement Chat overlay for Dogfooding app

dogfooding/lib/app/app.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ class _StreamDogFoodingAppState extends State<StreamDogFoodingApp> {
9292
// This means that the app is now ready to use.
9393
if (snapshot.connectionState == ConnectionState.done) {
9494
if (snapshot.hasError) {
95-
print(snapshot.error);
96-
print(snapshot.stackTrace);
95+
debugPrint(snapshot.error.toString());
96+
debugPrint(snapshot.stackTrace.toString());
97+
9798
return const Directionality(
9899
textDirection: TextDirection.ltr,
99100
child: Center(child: Text('Error loading app')),

dogfooding/lib/core/repos/user_auth_repository.dart

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class UserAuthRepository {
3636

3737
extension on UserResponseData {
3838
/// Converts [UserResponseData] to [UserInfo]
39+
// ignore: unused_element
3940
UserInfo toUserInfo() {
4041
return UserInfo(
4142
id: id,

dogfooding/lib/screens/home_screen.dart

-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ class _HomeScreenState extends State<HomeScreen> {
166166

167167
class _JoinForm extends StatelessWidget {
168168
const _JoinForm({
169-
super.key,
170169
required this.callIdController,
171170
required this.onJoinPressed,
172171
});

packages/stream_video/example/main.dart

-1
This file was deleted.

packages/stream_video/lib/src/call/call.dart

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: deprecated_member_use_from_same_package
2+
13
import 'dart:async';
24

35
import 'package:meta/meta.dart';
@@ -265,11 +267,6 @@ class Call {
265267
_connectOptions = connectOptions;
266268
}
267269

268-
// This is only used in [_onStateChanged] to determine the difference between
269-
// the previous and current state. It should not be used for any other
270-
// purpose. It is not guaranteed to be the latest, Use [state] instead.
271-
CallState? _prevState;
272-
273270
void _observeState() {
274271
_subscriptions.add(
275272
_idState,
@@ -313,8 +310,6 @@ class Call {
313310
state.settings.audio.opusDtxEnabled;
314311
_sessionFactory.sdpEditor.opusRedEnabled =
315312
state.settings.audio.redundantCodingEnabled;
316-
317-
_prevState = state;
318313
}
319314

320315
Future<void> _onCoordinatorEvent(CoordinatorCallEvent event) async {
@@ -530,7 +525,6 @@ class Call {
530525
}
531526

532527
Future<Result<CallCredentials>> _joinIfNeeded() async {
533-
final state = this.state.value;
534528
final creds = _credentials;
535529
if (creds != null) {
536530
_logger.w(() => '[joinIfNeeded] rejected (already joined): $creds');
@@ -605,8 +599,10 @@ class Call {
605599
_stateManager
606600
.lifecycleCallConnectingAction(CallConnecting(_reconnectAttempt));
607601
if (_status.value == _ConnectionStatus.disconnected) {
608-
_logger.w(() =>
609-
'[reconnect] attempt($_reconnectAttempt) rejected (disconnected)');
602+
_logger.w(
603+
() =>
604+
'[reconnect] attempt($_reconnectAttempt) rejected (disconnected)',
605+
);
610606
_logger.v(() => '[reconnect] <<<<<<<<<<<<<<< rejected');
611607
return;
612608
}
@@ -947,9 +943,6 @@ class Call {
947943

948944
/// Allows you to create a new call with the given parameters
949945
/// and joins the call immediately.
950-
///
951-
/// If a call with the same [cid] already exists,
952-
/// it will join the existing call.
953946
Future<Result<CallJoinedData>> _joinCall({
954947
bool create = false,
955948
}) async {
@@ -1046,7 +1039,9 @@ class Call {
10461039

10471040
if (result.isSuccess) {
10481041
_stateManager.setCallBroadcasting(
1049-
isBroadcasting: true, hlsPlaylistUrl: result.getDataOrNull());
1042+
isBroadcasting: true,
1043+
hlsPlaylistUrl: result.getDataOrNull(),
1044+
);
10501045
}
10511046
return result;
10521047
}

packages/stream_video/lib/src/call/call_connect_options.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CallConnectOptions with EquatableMixin {
3535
return 'CallConnectOptions{'
3636
'camera: $camera,'
3737
' microphone: $microphone,'
38-
' screenShare: $screenShare,'
38+
' screenShare: $screenShare, '
3939
'}';
4040
}
4141
}

packages/stream_video/lib/src/call/permissions/permissions_manager.dart

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import 'package:meta/meta.dart';
22

3-
import '../../../open_api/video/coordinator/api.dart';
43
import '../../../stream_video.dart';
5-
import '../../models/call_reaction.dart';
6-
import '../../models/queried_members.dart';
7-
import '../../utils/none.dart';
84
import '../state/call_state_notifier.dart';
95

106
typedef GetStateOrNull = CallState? Function();

packages/stream_video/lib/src/call/session/call_session.dart

+8-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import '../../sfu/sfu_client_impl.dart';
1919
import '../../sfu/ws/sfu_ws.dart';
2020
import '../../shared_emitter.dart';
2121
import '../../utils/debounce_buffer.dart';
22-
import '../../utils/none.dart';
2322
import '../../webrtc/model/rtc_model_mapper_extensions.dart';
2423
import '../../webrtc/model/rtc_tracks_info.dart';
2524
import '../../webrtc/model/stats/rtc_printable_stats.dart';
@@ -289,13 +288,16 @@ class CallSession extends Disposable {
289288
await track.stop();
290289
}
291290

292-
Future<void> _onPublishQualityChanged(SfuChangePublishQualityEvent event) async {
291+
Future<void> _onPublishQualityChanged(
292+
SfuChangePublishQualityEvent event,
293+
) async {
293294
_logger.d(() => '[onPublishQualityChanged] event: $event');
294295

295296
final enabledRids = event.videoSenders.firstOrNull?.layers
296-
.where((e) => e.active)
297-
.map((e) => e.name)
298-
.toSet() ?? {};
297+
.where((e) => e.active)
298+
.map((e) => e.name)
299+
.toSet() ??
300+
{};
299301

300302
_logger.v(() => '[onPublishQualityChanged] Enabled RIDs: $enabledRids');
301303

@@ -332,7 +334,7 @@ class CallSession extends Disposable {
332334
sfu.TrackMuteState(
333335
trackType: track.trackType.toDTO(),
334336
muted: muted,
335-
)
337+
),
336338
],
337339
),
338340
);

packages/stream_video/lib/src/call/state/mixins/state_coordinator_mixin.dart

+8-4
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,20 @@ mixin StateCoordinatorMixin on StateNotifier<CallState> {
3636
) {
3737
final status = state.status;
3838
if (status is! CallStatusOutgoing) {
39-
_logger.w(() =>
40-
'[coordinatorUpdateCallAccepted] rejected (status is not Outgoing)');
39+
_logger.w(
40+
() =>
41+
'[coordinatorUpdateCallAccepted] rejected (status is not Outgoing)',
42+
);
4143
return;
4244
}
4345
final participant = state.callParticipants.firstWhereOrNull((participant) {
4446
return participant.userId == event.acceptedByUserId;
4547
});
4648
if (participant == null) {
47-
_logger.w(() =>
48-
'[coordinatorUpdateCallAccepted] rejected (accepted by non-Member)');
49+
_logger.w(
50+
() =>
51+
'[coordinatorUpdateCallAccepted] rejected (accepted by non-Member)',
52+
);
4953
return;
5054
}
5155
state = state.copyWith(

packages/stream_video/lib/src/call/state/mixins/state_participant_mixin.dart

+7-6
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,16 @@ mixin StateParticipantMixin on StateNotifier<CallState> {
4444
void participantUpdateViewportVisibilities(
4545
UpdateViewportVisibilities action,
4646
) {
47-
for (final action in action.actions) {
48-
participantUpdateViewportVisibility(action);
49-
}
47+
action.actions.forEach(participantUpdateViewportVisibility);
5048
}
5149

5250
void participantUpdateSubscriptions(
5351
UpdateSubscriptions action,
5452
) {
5553
final sessionId = state.sessionId;
5654
_logger.d(
57-
() => '[participantUpdateSubscriptions] #$sessionId; action: $action');
55+
() => '[participantUpdateSubscriptions] #$sessionId; action: $action',
56+
);
5857
for (final action in action.actions) {
5958
if (action is UpdateSubscription) {
6059
participantUpdateSubscription(action);
@@ -67,8 +66,10 @@ mixin StateParticipantMixin on StateNotifier<CallState> {
6766
void participantUpdateSubscription(
6867
UpdateSubscription action,
6968
) {
70-
_logger.d(() =>
71-
'[participantUpdateSubscription] #${state.sessionId}; action: $action');
69+
_logger.d(
70+
() =>
71+
'[participantUpdateSubscription] #${state.sessionId}; action: $action',
72+
);
7273
state = state.copyWith(
7374
callParticipants: state.callParticipants.map((participant) {
7475
final trackState = participant.publishedTracks[action.trackType];

packages/stream_video/lib/src/call/state/mixins/state_rtc_mixin.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mixin StateRtcMixin on StateNotifier<CallState> {
2929
muted: false,
3030
subscribed: true,
3131
received: true,
32-
)
32+
),
3333
},
3434
);
3535
} else {

packages/stream_video/lib/src/call/state/mixins/state_sfu_mixin.dart

+4-3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ mixin StateSfuMixin on StateNotifier<CallState> {
4848
final participants = event.callState.participants.map((aParticipant) {
4949
final isLocal = aParticipant.userId == state.currentUserId;
5050
final existing = state.callParticipants.firstWhereOrNull(
51-
(it) => it.userId == aParticipant.userId
52-
&& it.sessionId == aParticipant.sessionId,
51+
(it) =>
52+
it.userId == aParticipant.userId &&
53+
it.sessionId == aParticipant.sessionId,
5354
);
5455
final existingName = existing?.name ?? '';
5556
final existingRole = existing?.role ?? '';
@@ -63,7 +64,7 @@ mixin StateSfuMixin on StateNotifier<CallState> {
6364
trackIdPrefix: aParticipant.trackLookupPrefix,
6465
publishedTracks: {
6566
for (final track in aParticipant.publishedTracks)
66-
track: TrackState.base(isLocal: isLocal)
67+
track: TrackState.base(isLocal: isLocal),
6768
},
6869
isLocal: isLocal,
6970
isOnline: !isLocal,

packages/stream_video/lib/src/coordinator/coordinator_socket_listener.dart

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: one_member_abstracts
2+
13
import 'models/coordinator_events.dart';
24

35
abstract class CoordinatorEventListener {

packages/stream_video/lib/src/coordinator/open_api/coordinator_client_open_api.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import '../models/coordinator_models.dart';
3838
import 'coordinator_ws_open_api.dart';
3939
import 'open_api_extensions.dart';
4040

41-
const _idEvents = 1;
4241
const _waitForConnectionTimeout = 5000;
4342

4443
/// An accessor that allows us to communicate with the API around video calls.
@@ -62,6 +61,7 @@ class CoordinatorClientOpenApi extends CoordinatorClient {
6261
final String _apiKey;
6362
final String _wsUrl;
6463
final TokenManager _tokenManager;
64+
// ignore: unused_field
6565
final LatencyService _latencyService;
6666
final RetryPolicy _retryPolicy;
6767

@@ -80,6 +80,7 @@ class CoordinatorClientOpenApi extends CoordinatorClient {
8080
),
8181
);
8282
late final _defaultApi = open.DefaultApi(_apiClient);
83+
// ignore: unused_field
8384
late final _serverSideApi = open.ServerSideApi(_apiClient);
8485
late final _locationService = LocationService();
8586

packages/stream_video/lib/src/coordinator/open_api/coordinator_ws_open_api.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import 'dart:async';
22
import 'dart:convert';
33

4+
import 'package:web_socket_channel/web_socket_channel.dart';
5+
46
import '../../../composed_version.dart';
57
import '../../../open_api/video/coordinator/api.dart' as open;
68
import '../../core/video_error.dart';
@@ -12,7 +14,6 @@ import '../../token/token_manager.dart';
1214
import '../../types/other.dart';
1315
import '../../utils/none.dart';
1416
import '../../utils/result.dart';
15-
import '../../ws/base_ws.dart';
1617
import '../../ws/health/health_monitor.dart';
1718
import '../coordinator_ws.dart';
1819
import '../models/coordinator_events.dart';
@@ -121,7 +122,7 @@ class CoordinatorWebSocketOpenApi extends CoordinatorWebSocket
121122
'custom': <String, dynamic>{
122123
'name': userInfo.name,
123124
if (image != null) ...{'image': image},
124-
...?userInfo.extraData,
125+
...userInfo.extraData,
125126
},
126127
},
127128
};
@@ -145,6 +146,7 @@ class CoordinatorWebSocketOpenApi extends CoordinatorWebSocket
145146
healthMonitor.onSocketError(error);
146147
connectionState = ConnectionState.failed;
147148

149+
// ignore: unused_local_variable
148150
StreamVideoWebSocketError wsError;
149151
if (error is WebSocketChannelException) {
150152
wsError = StreamVideoWebSocketError.fromWebSocketChannelError(error);
@@ -193,7 +195,7 @@ class CoordinatorWebSocketOpenApi extends CoordinatorWebSocket
193195
OpenApiError? dtoError;
194196
OpenApiEvent? dtoEvent;
195197
try {
196-
final jsonDecoded = json.decode(message);
198+
final jsonDecoded = json.decode(message) as Map<String, dynamic>;
197199
dtoError = OpenApiError.fromJson(jsonDecoded);
198200
dtoEvent = OpenApiEvent.fromJson(jsonDecoded);
199201
} catch (e, stk) {

packages/stream_video/lib/src/coordinator/open_api/error/open_api_error.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class OpenApiError {
99
return OpenApiError.fromJson(json.decode(rawJson));
1010
}
1111

12-
static OpenApiError? fromJson(dynamic jsonObj) {
12+
static OpenApiError? fromJson(Map<String, dynamic> jsonObj) {
1313
final errorObj = jsonObj['error'];
1414
if (errorObj == null) {
1515
return null;

packages/stream_video/lib/src/coordinator/open_api/error/open_api_error_code.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class OpenApiErrorCode {
1+
mixin OpenApiErrorCode {
22
static const tokenExpired = 40;
33
static const tokenNotValid = 41;
44
static const tokenDateIncorrect = 42;
@@ -9,6 +9,6 @@ class OpenApiErrorCode {
99
tokenExpired,
1010
tokenNotValid,
1111
tokenDateIncorrect,
12-
tokenSignatureIncorrect
12+
tokenSignatureIncorrect,
1313
];
1414
}

0 commit comments

Comments
 (0)