Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Test for null instead of enforcing non-null
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanbeusekom committed Feb 4, 2021
1 parent f04ec41 commit ac243a0
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,16 @@ class MethodChannelCamera extends CameraPlatform {

@override
Future<void> dispose(int cameraId) async {
if (_channels.containsKey(cameraId)) {
final cameraChannel = _channels[cameraId];
cameraChannel?.setMethodCallHandler(null);
_channels.remove(cameraId);
}

await _channel.invokeMethod<void>(
'dispose',
<String, dynamic>{'cameraId': cameraId},
);

if (_channels.containsKey(cameraId)) {
_channels[cameraId]!.setMethodCallHandler(null);
_channels.remove(cameraId);
}
}

@override
Expand Down

0 comments on commit ac243a0

Please sign in to comment.