[camera] Switch app-facing package to new analysis options (#4808)

diff --git a/packages/camera/camera/CHANGELOG.md b/packages/camera/camera/CHANGELOG.md
index e92a7a8..d2b2f90 100644
--- a/packages/camera/camera/CHANGELOG.md
+++ b/packages/camera/camera/CHANGELOG.md
@@ -1,19 +1,20 @@
-## NEXT
+## 0.9.4+12
 
 * Skips unnecessary AppDelegate setup for unit tests on iOS.
-  
+* Internal code cleanup for stricter analysis options.
+
 ## 0.9.4+11
 
-* Manages iOS camera's orientation-related states on a background queue to prevent potential race conditions. 
+* Manages iOS camera's orientation-related states on a background queue to prevent potential race conditions.
 
 ## 0.9.4+10
 
-* iOS performance improvement by moving file writing from the main queue to a background IO queue. 
+* iOS performance improvement by moving file writing from the main queue to a background IO queue.
 
 ## 0.9.4+9
 
-* iOS performance improvement by moving sample buffer handling from the main queue to a background session queue. 
-* Minor iOS internal code cleanup related to camera class and its delegate. 
+* iOS performance improvement by moving sample buffer handling from the main queue to a background session queue.
+* Minor iOS internal code cleanup related to camera class and its delegate.
 * Minor iOS internal code cleanup related to resolution preset, video format, focus mode, exposure mode and device orientation.
 * Minor iOS internal code cleanup related to flash mode.
 
@@ -23,12 +24,12 @@
 
 ## 0.9.4+7
 
-* Fixes a crash in iOS when passing null queue pointer into AVFoundation API due to race condition.  
+* Fixes a crash in iOS when passing null queue pointer into AVFoundation API due to race condition.
 * Minor iOS internal code cleanup related to dispatch queue.
 
 ## 0.9.4+6
 
-* Fixes a crash in iOS when using image stream due to calling Flutter engine API on non-main thread. 
+* Fixes a crash in iOS when using image stream due to calling Flutter engine API on non-main thread.
 
 ## 0.9.4+5
 
diff --git a/packages/camera/camera/analysis_options.yaml b/packages/camera/camera/analysis_options.yaml
deleted file mode 100644
index 5aeb4e7..0000000
--- a/packages/camera/camera/analysis_options.yaml
+++ /dev/null
@@ -1 +0,0 @@
-include: ../../../analysis_options_legacy.yaml
diff --git a/packages/camera/camera/example/integration_test/camera_test.dart b/packages/camera/camera/example/integration_test/camera_test.dart
index 3af291a..557f485 100644
--- a/packages/camera/camera/example/integration_test/camera_test.dart
+++ b/packages/camera/camera/example/integration_test/camera_test.dart
@@ -9,9 +9,9 @@
 import 'package:camera/camera.dart';
 import 'package:flutter/painting.dart';
 import 'package:flutter_test/flutter_test.dart';
+import 'package:integration_test/integration_test.dart';
 import 'package:path_provider/path_provider.dart';
 import 'package:video_player/video_player.dart';
-import 'package:integration_test/integration_test.dart';
 
 void main() {
   late Directory testDir;
@@ -59,7 +59,7 @@
         'Capturing photo at $preset (${expectedSize.width}x${expectedSize.height}) using camera ${controller.description.name}');
 
     // Take Picture
-    final file = await controller.takePicture();
+    final XFile file = await controller.takePicture();
 
     // Load picture
     final File fileImage = File(file.path);
@@ -78,9 +78,9 @@
       if (cameras.isEmpty) {
         return;
       }
-      for (CameraDescription cameraDescription in cameras) {
+      for (final CameraDescription cameraDescription in cameras) {
         bool previousPresetExactlySupported = true;
-        for (MapEntry<ResolutionPreset, Size> preset
+        for (final MapEntry<ResolutionPreset, Size> preset
             in presetExpectedSizes.entries) {
           final CameraController controller =
               CameraController(cameraDescription, preset.key);
@@ -110,7 +110,7 @@
     // Take Video
     await controller.startVideoRecording();
     sleep(const Duration(milliseconds: 300));
-    final file = await controller.stopVideoRecording();
+    final XFile file = await controller.stopVideoRecording();
 
     // Load video metadata
     final File videoFile = File(file.path);
@@ -132,9 +132,9 @@
       if (cameras.isEmpty) {
         return;
       }
-      for (CameraDescription cameraDescription in cameras) {
+      for (final CameraDescription cameraDescription in cameras) {
         bool previousPresetExactlySupported = true;
-        for (MapEntry<ResolutionPreset, Size> preset
+        for (final MapEntry<ResolutionPreset, Size> preset
             in presetExpectedSizes.entries) {
           final CameraController controller =
               CameraController(cameraDescription, preset.key);
@@ -191,7 +191,7 @@
 
     sleep(const Duration(milliseconds: 500));
 
-    final file = await controller.stopVideoRecording();
+    final XFile file = await controller.stopVideoRecording();
     final int recordingTime =
         DateTime.now().millisecondsSinceEpoch - recordingStart;
 
@@ -224,7 +224,9 @@
       bool _isDetecting = false;
 
       await controller.startImageStream((CameraImage image) {
-        if (_isDetecting) return;
+        if (_isDetecting) {
+          return;
+        }
 
         _isDetecting = true;
 
@@ -252,14 +254,14 @@
     );
 
     await controller.initialize();
-    final _completer = Completer<CameraImage>();
+    final Completer<CameraImage> _completer = Completer<CameraImage>();
 
     await controller.startImageStream((CameraImage image) {
       if (!_completer.isCompleted) {
-        Future(() async {
+        Future<void>(() async {
           await controller.stopImageStream();
           await controller.dispose();
-        }).then((value) {
+        }).then((Object? value) {
           _completer.complete(image);
         });
       }
@@ -275,7 +277,7 @@
         return;
       }
 
-      var _image = await startStreaming(cameras, null);
+      CameraImage _image = await startStreaming(cameras, null);
       expect(_image, isNotNull);
       expect(_image.format.group, ImageFormatGroup.bgra8888);
       expect(_image.planes.length, 1);
diff --git a/packages/camera/camera/example/lib/main.dart b/packages/camera/camera/example/lib/main.dart
index a3a5d1d..d47edfe 100644
--- a/packages/camera/camera/example/lib/main.dart
+++ b/packages/camera/camera/example/lib/main.dart
@@ -194,7 +194,8 @@
               behavior: HitTestBehavior.opaque,
               onScaleStart: _handleScaleStart,
               onScaleUpdate: _handleScaleUpdate,
-              onTapDown: (details) => onViewFinderTap(details, constraints),
+              onTapDown: (TapDownDetails details) =>
+                  onViewFinderTap(details, constraints),
             );
           }),
         ),
@@ -228,34 +229,34 @@
         child: Row(
           mainAxisSize: MainAxisSize.min,
           children: <Widget>[
-            localVideoController == null && imageFile == null
-                ? Container()
-                : SizedBox(
-                    child: (localVideoController == null)
-                        ? (
-                            // The captured image on the web contains a network-accessible URL
-                            // pointing to a location within the browser. It may be displayed
-                            // either with Image.network or Image.memory after loading the image
-                            // bytes to memory.
-                            kIsWeb
-                                ? Image.network(imageFile!.path)
-                                : Image.file(File(imageFile!.path)))
-                        : Container(
-                            child: Center(
-                              child: AspectRatio(
-                                  aspectRatio:
-                                      localVideoController.value.size != null
-                                          ? localVideoController
-                                              .value.aspectRatio
-                                          : 1.0,
-                                  child: VideoPlayer(localVideoController)),
-                            ),
-                            decoration: BoxDecoration(
-                                border: Border.all(color: Colors.pink)),
-                          ),
-                    width: 64.0,
-                    height: 64.0,
-                  ),
+            if (localVideoController == null && imageFile == null)
+              Container()
+            else
+              SizedBox(
+                child: (localVideoController == null)
+                    ? (
+                        // The captured image on the web contains a network-accessible URL
+                        // pointing to a location within the browser. It may be displayed
+                        // either with Image.network or Image.memory after loading the image
+                        // bytes to memory.
+                        kIsWeb
+                            ? Image.network(imageFile!.path)
+                            : Image.file(File(imageFile!.path)))
+                    : Container(
+                        child: Center(
+                          child: AspectRatio(
+                              aspectRatio:
+                                  localVideoController.value.size != null
+                                      ? localVideoController.value.aspectRatio
+                                      : 1.0,
+                              child: VideoPlayer(localVideoController)),
+                        ),
+                        decoration: BoxDecoration(
+                            border: Border.all(color: Colors.pink)),
+                      ),
+                width: 64.0,
+                height: 64.0,
+              ),
           ],
         ),
       ),
@@ -265,34 +266,34 @@
   /// Display a bar with buttons to change the flash and exposure modes
   Widget _modeControlRowWidget() {
     return Column(
-      children: [
+      children: <Widget>[
         Row(
           mainAxisAlignment: MainAxisAlignment.spaceEvenly,
           mainAxisSize: MainAxisSize.max,
           children: <Widget>[
             IconButton(
-              icon: Icon(Icons.flash_on),
+              icon: const Icon(Icons.flash_on),
               color: Colors.blue,
               onPressed: controller != null ? onFlashModeButtonPressed : null,
             ),
             // The exposure and focus mode are currently not supported on the web.
-            ...(!kIsWeb
-                ? [
+            ...!kIsWeb
+                ? <Widget>[
                     IconButton(
-                      icon: Icon(Icons.exposure),
+                      icon: const Icon(Icons.exposure),
                       color: Colors.blue,
                       onPressed: controller != null
                           ? onExposureModeButtonPressed
                           : null,
                     ),
                     IconButton(
-                      icon: Icon(Icons.filter_center_focus),
+                      icon: const Icon(Icons.filter_center_focus),
                       color: Colors.blue,
                       onPressed:
                           controller != null ? onFocusModeButtonPressed : null,
                     )
                   ]
-                : []),
+                : <Widget>[],
             IconButton(
               icon: Icon(enableAudio ? Icons.volume_up : Icons.volume_mute),
               color: Colors.blue,
@@ -323,9 +324,9 @@
         child: Row(
           mainAxisAlignment: MainAxisAlignment.spaceEvenly,
           mainAxisSize: MainAxisSize.max,
-          children: [
+          children: <Widget>[
             IconButton(
-              icon: Icon(Icons.flash_off),
+              icon: const Icon(Icons.flash_off),
               color: controller?.value.flashMode == FlashMode.off
                   ? Colors.orange
                   : Colors.blue,
@@ -334,7 +335,7 @@
                   : null,
             ),
             IconButton(
-              icon: Icon(Icons.flash_auto),
+              icon: const Icon(Icons.flash_auto),
               color: controller?.value.flashMode == FlashMode.auto
                   ? Colors.orange
                   : Colors.blue,
@@ -343,7 +344,7 @@
                   : null,
             ),
             IconButton(
-              icon: Icon(Icons.flash_on),
+              icon: const Icon(Icons.flash_on),
               color: controller?.value.flashMode == FlashMode.always
                   ? Colors.orange
                   : Colors.blue,
@@ -352,7 +353,7 @@
                   : null,
             ),
             IconButton(
-              icon: Icon(Icons.highlight),
+              icon: const Icon(Icons.highlight),
               color: controller?.value.flashMode == FlashMode.torch
                   ? Colors.orange
                   : Colors.blue,
@@ -384,16 +385,16 @@
         child: Container(
           color: Colors.grey.shade50,
           child: Column(
-            children: [
-              Center(
-                child: Text("Exposure Mode"),
+            children: <Widget>[
+              const Center(
+                child: Text('Exposure Mode'),
               ),
               Row(
                 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                 mainAxisSize: MainAxisSize.max,
-                children: [
+                children: <Widget>[
                   TextButton(
-                    child: Text('AUTO'),
+                    child: const Text('AUTO'),
                     style: styleAuto,
                     onPressed: controller != null
                         ? () =>
@@ -407,7 +408,7 @@
                     },
                   ),
                   TextButton(
-                    child: Text('LOCKED'),
+                    child: const Text('LOCKED'),
                     style: styleLocked,
                     onPressed: controller != null
                         ? () =>
@@ -415,7 +416,7 @@
                         : null,
                   ),
                   TextButton(
-                    child: Text('RESET OFFSET'),
+                    child: const Text('RESET OFFSET'),
                     style: styleLocked,
                     onPressed: controller != null
                         ? () => controller!.setExposureOffset(0.0)
@@ -423,13 +424,13 @@
                   ),
                 ],
               ),
-              Center(
-                child: Text("Exposure Offset"),
+              const Center(
+                child: Text('Exposure Offset'),
               ),
               Row(
                 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                 mainAxisSize: MainAxisSize.max,
-                children: [
+                children: <Widget>[
                   Text(_minAvailableExposureOffset.toString()),
                   Slider(
                     value: _currentExposureOffset,
@@ -469,27 +470,29 @@
         child: Container(
           color: Colors.grey.shade50,
           child: Column(
-            children: [
-              Center(
-                child: Text("Focus Mode"),
+            children: <Widget>[
+              const Center(
+                child: Text('Focus Mode'),
               ),
               Row(
                 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                 mainAxisSize: MainAxisSize.max,
-                children: [
+                children: <Widget>[
                   TextButton(
-                    child: Text('AUTO'),
+                    child: const Text('AUTO'),
                     style: styleAuto,
                     onPressed: controller != null
                         ? () => onSetFocusModeButtonPressed(FocusMode.auto)
                         : null,
                     onLongPress: () {
-                      if (controller != null) controller!.setFocusPoint(null);
+                      if (controller != null) {
+                        controller!.setFocusPoint(null);
+                      }
                       showInSnackBar('Resetting focus point');
                     },
                   ),
                   TextButton(
-                    child: Text('LOCKED'),
+                    child: const Text('LOCKED'),
                     style: styleLocked,
                     onPressed: controller != null
                         ? () => onSetFocusModeButtonPressed(FocusMode.locked)
@@ -533,8 +536,8 @@
         IconButton(
           icon: cameraController != null &&
                   cameraController.value.isRecordingPaused
-              ? Icon(Icons.play_arrow)
-              : Icon(Icons.pause),
+              ? const Icon(Icons.play_arrow)
+              : const Icon(Icons.pause),
           color: Colors.blue,
           onPressed: cameraController != null &&
                   cameraController.value.isInitialized &&
@@ -570,7 +573,8 @@
   Widget _cameraTogglesRowWidget() {
     final List<Widget> toggles = <Widget>[];
 
-    final onChanged = (CameraDescription? description) {
+    final Null Function(CameraDescription? description) onChanged =
+        (CameraDescription? description) {
       if (description == null) {
         return;
       }
@@ -581,7 +585,7 @@
     if (cameras.isEmpty) {
       return const Text('No camera found');
     } else {
-      for (CameraDescription cameraDescription in cameras) {
+      for (final CameraDescription cameraDescription in cameras) {
         toggles.add(
           SizedBox(
             width: 90.0,
@@ -616,7 +620,7 @@
 
     final CameraController cameraController = controller!;
 
-    final offset = Offset(
+    final Offset offset = Offset(
       details.localPosition.dx / constraints.maxWidth,
       details.localPosition.dy / constraints.maxHeight,
     );
@@ -624,7 +628,7 @@
     cameraController.setFocusPoint(offset);
   }
 
-  void onNewCameraSelected(CameraDescription cameraDescription) async {
+  Future<void> onNewCameraSelected(CameraDescription cameraDescription) async {
     if (controller != null) {
       await controller!.dispose();
     }
@@ -640,7 +644,9 @@
 
     // If the controller is updated then update the UI.
     cameraController.addListener(() {
-      if (mounted) setState(() {});
+      if (mounted) {
+        setState(() {});
+      }
       if (cameraController.value.hasError) {
         showInSnackBar(
             'Camera error ${cameraController.value.errorDescription}');
@@ -649,24 +655,23 @@
 
     try {
       await cameraController.initialize();
-      await Future.wait([
+      await Future.wait(<Future<Object?>>[
         // The exposure mode is currently not supported on the web.
-        ...(!kIsWeb
-            ? [
-                cameraController
-                    .getMinExposureOffset()
-                    .then((value) => _minAvailableExposureOffset = value),
+        ...!kIsWeb
+            ? <Future<Object?>>[
+                cameraController.getMinExposureOffset().then(
+                    (double value) => _minAvailableExposureOffset = value),
                 cameraController
                     .getMaxExposureOffset()
-                    .then((value) => _maxAvailableExposureOffset = value)
+                    .then((double value) => _maxAvailableExposureOffset = value)
               ]
-            : []),
+            : <Future<Object?>>[],
         cameraController
             .getMaxZoomLevel()
-            .then((value) => _maxAvailableZoom = value),
+            .then((double value) => _maxAvailableZoom = value),
         cameraController
             .getMinZoomLevel()
-            .then((value) => _minAvailableZoom = value),
+            .then((double value) => _minAvailableZoom = value),
       ]);
     } on CameraException catch (e) {
       _showCameraException(e);
@@ -685,7 +690,9 @@
           videoController?.dispose();
           videoController = null;
         });
-        if (file != null) showInSnackBar('Picture saved to ${file.path}');
+        if (file != null) {
+          showInSnackBar('Picture saved to ${file.path}');
+        }
       }
     });
   }
@@ -727,7 +734,7 @@
     }
   }
 
-  void onCaptureOrientationLockButtonPressed() async {
+  Future<void> onCaptureOrientationLockButtonPressed() async {
     try {
       if (controller != null) {
         final CameraController cameraController = controller!;
@@ -747,34 +754,44 @@
 
   void onSetFlashModeButtonPressed(FlashMode mode) {
     setFlashMode(mode).then((_) {
-      if (mounted) setState(() {});
+      if (mounted) {
+        setState(() {});
+      }
       showInSnackBar('Flash mode set to ${mode.toString().split('.').last}');
     });
   }
 
   void onSetExposureModeButtonPressed(ExposureMode mode) {
     setExposureMode(mode).then((_) {
-      if (mounted) setState(() {});
+      if (mounted) {
+        setState(() {});
+      }
       showInSnackBar('Exposure mode set to ${mode.toString().split('.').last}');
     });
   }
 
   void onSetFocusModeButtonPressed(FocusMode mode) {
     setFocusMode(mode).then((_) {
-      if (mounted) setState(() {});
+      if (mounted) {
+        setState(() {});
+      }
       showInSnackBar('Focus mode set to ${mode.toString().split('.').last}');
     });
   }
 
   void onVideoRecordButtonPressed() {
     startVideoRecording().then((_) {
-      if (mounted) setState(() {});
+      if (mounted) {
+        setState(() {});
+      }
     });
   }
 
   void onStopButtonPressed() {
-    stopVideoRecording().then((file) {
-      if (mounted) setState(() {});
+    stopVideoRecording().then((XFile? file) {
+      if (mounted) {
+        setState(() {});
+      }
       if (file != null) {
         showInSnackBar('Video recorded to ${file.path}');
         videoFile = file;
@@ -797,19 +814,25 @@
       await cameraController.pausePreview();
     }
 
-    if (mounted) setState(() {});
+    if (mounted) {
+      setState(() {});
+    }
   }
 
   void onPauseButtonPressed() {
     pauseVideoRecording().then((_) {
-      if (mounted) setState(() {});
+      if (mounted) {
+        setState(() {});
+      }
       showInSnackBar('Video recording paused');
     });
   }
 
   void onResumeButtonPressed() {
     resumeVideoRecording().then((_) {
-      if (mounted) setState(() {});
+      if (mounted) {
+        setState(() {});
+      }
       showInSnackBar('Video recording resumed');
     });
   }
@@ -854,7 +877,7 @@
     final CameraController? cameraController = controller;
 
     if (cameraController == null || !cameraController.value.isRecordingVideo) {
-      return null;
+      return;
     }
 
     try {
@@ -869,7 +892,7 @@
     final CameraController? cameraController = controller;
 
     if (cameraController == null || !cameraController.value.isRecordingVideo) {
-      return null;
+      return;
     }
 
     try {
@@ -947,7 +970,9 @@
     videoPlayerListener = () {
       if (videoController != null && videoController!.value.size != null) {
         // Refreshing the state to update video player with the correct ratio.
-        if (mounted) setState(() {});
+        if (mounted) {
+          setState(() {});
+        }
         videoController!.removeListener(videoPlayerListener!);
       }
     };
@@ -977,7 +1002,7 @@
     }
 
     try {
-      XFile file = await cameraController.takePicture();
+      final XFile file = await cameraController.takePicture();
       return file;
     } on CameraException catch (e) {
       _showCameraException(e);
@@ -1000,7 +1025,7 @@
   }
 }
 
-List<CameraDescription> cameras = [];
+List<CameraDescription> cameras = <CameraDescription>[];
 
 Future<void> main() async {
   // Fetch the available cameras before initializing the app.
diff --git a/packages/camera/camera/example/pubspec.yaml b/packages/camera/camera/example/pubspec.yaml
index 1899835..1700074 100644
--- a/packages/camera/camera/example/pubspec.yaml
+++ b/packages/camera/camera/example/pubspec.yaml
@@ -14,19 +14,18 @@
     # The example app is bundled with the plugin so we use a path dependency on
     # the parent directory to use the current plugin's version.
     path: ../
-  path_provider: ^2.0.0
   flutter:
     sdk: flutter
+  path_provider: ^2.0.0
   video_player: ^2.1.4
 
 dev_dependencies:
-  flutter_test:
-    sdk: flutter
   flutter_driver:
     sdk: flutter
+  flutter_test:
+    sdk: flutter
   integration_test:
     sdk: flutter
-  pedantic: ^1.10.0
 
 flutter:
   uses-material-design: true
diff --git a/packages/camera/camera/example/test_driver/integration_test.dart b/packages/camera/camera/example/test_driver/integration_test.dart
index dedb253..4ec97e6 100644
--- a/packages/camera/camera/example/test_driver/integration_test.dart
+++ b/packages/camera/camera/example/test_driver/integration_test.dart
@@ -18,7 +18,7 @@
   final bool adbExists =
       Process.runSync('which', <String>['adb']).exitCode == 0;
   if (!adbExists) {
-    print('This test needs ADB to exist on the \$PATH. Skipping...');
+    print(r'This test needs ADB to exist on the $PATH. Skipping...');
     exit(0);
   }
   print('Granting camera permissions...');
@@ -59,6 +59,6 @@
     'android.permission.RECORD_AUDIO'
   ]);
 
-  final Map<String, dynamic> result = jsonDecode(data);
+  final Map<String, dynamic> result = jsonDecode(data) as Map<String, dynamic>;
   exit(result['result'] == 'true' ? 0 : 1);
 }
diff --git a/packages/camera/camera/lib/camera.dart b/packages/camera/camera/lib/camera.dart
index 1e24efb..900c263 100644
--- a/packages/camera/camera/lib/camera.dart
+++ b/packages/camera/camera/lib/camera.dart
@@ -2,10 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-export 'src/camera_controller.dart';
-export 'src/camera_image.dart';
-export 'src/camera_preview.dart';
-
 export 'package:camera_platform_interface/camera_platform_interface.dart'
     show
         CameraDescription,
@@ -17,3 +13,7 @@
         ResolutionPreset,
         XFile,
         ImageFormatGroup;
+
+export 'src/camera_controller.dart';
+export 'src/camera_image.dart';
+export 'src/camera_preview.dart';
diff --git a/packages/camera/camera/lib/src/camera_controller.dart b/packages/camera/camera/lib/src/camera_controller.dart
index 8cf1e90..835ac16 100644
--- a/packages/camera/camera/lib/src/camera_controller.dart
+++ b/packages/camera/camera/lib/src/camera_controller.dart
@@ -10,15 +10,16 @@
 import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
-import 'package:pedantic/pedantic.dart';
 import 'package:quiver/core.dart';
 
-final MethodChannel _channel = const MethodChannel('plugins.flutter.io/camera');
+const MethodChannel _channel = MethodChannel('plugins.flutter.io/camera');
 
 /// Signature for a callback receiving the a camera image.
 ///
 /// This is used by [CameraController.startImageStream].
-// ignore: inference_failure_on_function_return_type
+// TODO(stuartmorgan): Fix this naming the next time there's a breaking change
+// to this package.
+// ignore: camel_case_types
 typedef onLatestImageAvailable = Function(CameraImage image);
 
 /// Completes with a list of available cameras.
@@ -192,7 +193,7 @@
 
   @override
   String toString() {
-    return '$runtimeType('
+    return '${objectRuntimeType(this, 'CameraValue')}('
         'isRecordingVideo: $isRecordingVideo, '
         'isInitialized: $isInitialized, '
         'errorDescription: $errorDescription, '
@@ -254,7 +255,8 @@
   bool _isDisposed = false;
   StreamSubscription<dynamic>? _imageStreamSubscription;
   FutureOr<bool>? _initCalled;
-  StreamSubscription? _deviceOrientationSubscription;
+  StreamSubscription<DeviceOrientationChangedEvent>?
+      _deviceOrientationSubscription;
 
   /// Checks whether [CameraController.dispose] has completed successfully.
   ///
@@ -277,10 +279,12 @@
       );
     }
     try {
-      Completer<CameraInitializedEvent> _initializeCompleter = Completer();
+      final Completer<CameraInitializedEvent> _initializeCompleter =
+          Completer<CameraInitializedEvent>();
 
-      _deviceOrientationSubscription =
-          CameraPlatform.instance.onDeviceOrientationChanged().listen((event) {
+      _deviceOrientationSubscription = CameraPlatform.instance
+          .onDeviceOrientationChanged()
+          .listen((DeviceOrientationChangedEvent event) {
         value = value.copyWith(
           deviceOrientation: event.orientation,
         );
@@ -295,7 +299,7 @@
       unawaited(CameraPlatform.instance
           .onCameraInitialized(_cameraId)
           .first
-          .then((event) {
+          .then((CameraInitializedEvent event) {
         _initializeCompleter.complete(event);
       }));
 
@@ -312,13 +316,13 @@
                   event.previewHeight,
                 )),
         exposureMode: await _initializeCompleter.future
-            .then((event) => event.exposureMode),
-        focusMode:
-            await _initializeCompleter.future.then((event) => event.focusMode),
-        exposurePointSupported: await _initializeCompleter.future
-            .then((event) => event.exposurePointSupported),
+            .then((CameraInitializedEvent event) => event.exposureMode),
+        focusMode: await _initializeCompleter.future
+            .then((CameraInitializedEvent event) => event.focusMode),
+        exposurePointSupported: await _initializeCompleter.future.then(
+            (CameraInitializedEvent event) => event.exposurePointSupported),
         focusPointSupported: await _initializeCompleter.future
-            .then((event) => event.focusPointSupported),
+            .then((CameraInitializedEvent event) => event.focusPointSupported),
       );
     } on PlatformException catch (e) {
       throw CameraException(e.code, e.message);
@@ -351,7 +355,8 @@
       await CameraPlatform.instance.pausePreview(_cameraId);
       value = value.copyWith(
           isPreviewPaused: true,
-          previewPauseOrientation: Optional.of(this.value.deviceOrientation));
+          previewPauseOrientation:
+              Optional<DeviceOrientation>.of(value.deviceOrientation));
     } on PlatformException catch (e) {
       throw CameraException(e.code, e.message);
     }
@@ -365,7 +370,8 @@
     try {
       await CameraPlatform.instance.resumePreview(_cameraId);
       value = value.copyWith(
-          isPreviewPaused: false, previewPauseOrientation: Optional.absent());
+          isPreviewPaused: false,
+          previewPauseOrientation: const Optional<DeviceOrientation>.absent());
     } on PlatformException catch (e) {
       throw CameraException(e.code, e.message);
     }
@@ -375,7 +381,7 @@
   ///
   /// Throws a [CameraException] if the capture fails.
   Future<XFile> takePicture() async {
-    _throwIfNotInitialized("takePicture");
+    _throwIfNotInitialized('takePicture');
     if (value.isTakingPicture) {
       throw CameraException(
         'Previous capture has not returned yet.',
@@ -384,7 +390,7 @@
     }
     try {
       value = value.copyWith(isTakingPicture: true);
-      XFile file = await CameraPlatform.instance.takePicture(_cameraId);
+      final XFile file = await CameraPlatform.instance.takePicture(_cameraId);
       value = value.copyWith(isTakingPicture: false);
       return file;
     } on PlatformException catch (e) {
@@ -413,7 +419,7 @@
   Future<void> startImageStream(onLatestImageAvailable onAvailable) async {
     assert(defaultTargetPlatform == TargetPlatform.android ||
         defaultTargetPlatform == TargetPlatform.iOS);
-    _throwIfNotInitialized("startImageStream");
+    _throwIfNotInitialized('startImageStream');
     if (value.isRecordingVideo) {
       throw CameraException(
         'A video recording is already started.',
@@ -438,7 +444,8 @@
     _imageStreamSubscription =
         cameraEventChannel.receiveBroadcastStream().listen(
       (dynamic imageData) {
-        onAvailable(CameraImage.fromPlatformData(imageData));
+        onAvailable(
+            CameraImage.fromPlatformData(imageData as Map<dynamic, dynamic>));
       },
     );
   }
@@ -453,7 +460,7 @@
   Future<void> stopImageStream() async {
     assert(defaultTargetPlatform == TargetPlatform.android ||
         defaultTargetPlatform == TargetPlatform.iOS);
-    _throwIfNotInitialized("stopImageStream");
+    _throwIfNotInitialized('stopImageStream');
     if (value.isRecordingVideo) {
       throw CameraException(
         'A video recording is already started.',
@@ -483,7 +490,7 @@
   /// The video is returned as a [XFile] after calling [stopVideoRecording].
   /// Throws a [CameraException] if the capture fails.
   Future<void> startVideoRecording() async {
-    _throwIfNotInitialized("startVideoRecording");
+    _throwIfNotInitialized('startVideoRecording');
     if (value.isRecordingVideo) {
       throw CameraException(
         'A video recording is already started.',
@@ -502,7 +509,7 @@
       value = value.copyWith(
           isRecordingVideo: true,
           isRecordingPaused: false,
-          recordingOrientation: Optional.fromNullable(
+          recordingOrientation: Optional<DeviceOrientation>.fromNullable(
               value.lockedCaptureOrientation ?? value.deviceOrientation));
     } on PlatformException catch (e) {
       throw CameraException(e.code, e.message);
@@ -513,7 +520,7 @@
   ///
   /// Throws a [CameraException] if the capture failed.
   Future<XFile> stopVideoRecording() async {
-    _throwIfNotInitialized("stopVideoRecording");
+    _throwIfNotInitialized('stopVideoRecording');
     if (!value.isRecordingVideo) {
       throw CameraException(
         'No video is recording',
@@ -521,10 +528,11 @@
       );
     }
     try {
-      XFile file = await CameraPlatform.instance.stopVideoRecording(_cameraId);
+      final XFile file =
+          await CameraPlatform.instance.stopVideoRecording(_cameraId);
       value = value.copyWith(
         isRecordingVideo: false,
-        recordingOrientation: Optional.absent(),
+        recordingOrientation: const Optional<DeviceOrientation>.absent(),
       );
       return file;
     } on PlatformException catch (e) {
@@ -536,7 +544,7 @@
   ///
   /// This feature is only available on iOS and Android sdk 24+.
   Future<void> pauseVideoRecording() async {
-    _throwIfNotInitialized("pauseVideoRecording");
+    _throwIfNotInitialized('pauseVideoRecording');
     if (!value.isRecordingVideo) {
       throw CameraException(
         'No video is recording',
@@ -555,7 +563,7 @@
   ///
   /// This feature is only available on iOS and Android sdk 24+.
   Future<void> resumeVideoRecording() async {
-    _throwIfNotInitialized("resumeVideoRecording");
+    _throwIfNotInitialized('resumeVideoRecording');
     if (!value.isRecordingVideo) {
       throw CameraException(
         'No video is recording',
@@ -572,7 +580,7 @@
 
   /// Returns a widget showing a live camera preview.
   Widget buildPreview() {
-    _throwIfNotInitialized("buildPreview");
+    _throwIfNotInitialized('buildPreview');
     try {
       return CameraPlatform.instance.buildPreview(_cameraId);
     } on PlatformException catch (e) {
@@ -582,7 +590,7 @@
 
   /// Gets the maximum supported zoom level for the selected camera.
   Future<double> getMaxZoomLevel() {
-    _throwIfNotInitialized("getMaxZoomLevel");
+    _throwIfNotInitialized('getMaxZoomLevel');
     try {
       return CameraPlatform.instance.getMaxZoomLevel(_cameraId);
     } on PlatformException catch (e) {
@@ -592,7 +600,7 @@
 
   /// Gets the minimum supported zoom level for the selected camera.
   Future<double> getMinZoomLevel() {
-    _throwIfNotInitialized("getMinZoomLevel");
+    _throwIfNotInitialized('getMinZoomLevel');
     try {
       return CameraPlatform.instance.getMinZoomLevel(_cameraId);
     } on PlatformException catch (e) {
@@ -606,7 +614,7 @@
   /// zoom level returned by the `getMaxZoomLevel`. Throws an `CameraException`
   /// when an illegal zoom level is suplied.
   Future<void> setZoomLevel(double zoom) {
-    _throwIfNotInitialized("setZoomLevel");
+    _throwIfNotInitialized('setZoomLevel');
     try {
       return CameraPlatform.instance.setZoomLevel(_cameraId, zoom);
     } on PlatformException catch (e) {
@@ -662,7 +670,7 @@
 
   /// Gets the minimum supported exposure offset for the selected camera in EV units.
   Future<double> getMinExposureOffset() async {
-    _throwIfNotInitialized("getMinExposureOffset");
+    _throwIfNotInitialized('getMinExposureOffset');
     try {
       return CameraPlatform.instance.getMinExposureOffset(_cameraId);
     } on PlatformException catch (e) {
@@ -672,7 +680,7 @@
 
   /// Gets the maximum supported exposure offset for the selected camera in EV units.
   Future<double> getMaxExposureOffset() async {
-    _throwIfNotInitialized("getMaxExposureOffset");
+    _throwIfNotInitialized('getMaxExposureOffset');
     try {
       return CameraPlatform.instance.getMaxExposureOffset(_cameraId);
     } on PlatformException catch (e) {
@@ -684,7 +692,7 @@
   ///
   /// Returns 0 when the camera supports using a free value without stepping.
   Future<double> getExposureOffsetStepSize() async {
-    _throwIfNotInitialized("getExposureOffsetStepSize");
+    _throwIfNotInitialized('getExposureOffsetStepSize');
     try {
       return CameraPlatform.instance.getExposureOffsetStepSize(_cameraId);
     } on PlatformException catch (e) {
@@ -704,21 +712,21 @@
   ///
   /// Returns the (rounded) offset value that was set.
   Future<double> setExposureOffset(double offset) async {
-    _throwIfNotInitialized("setExposureOffset");
+    _throwIfNotInitialized('setExposureOffset');
     // Check if offset is in range
-    List<double> range =
-        await Future.wait([getMinExposureOffset(), getMaxExposureOffset()]);
+    final List<double> range = await Future.wait(
+        <Future<double>>[getMinExposureOffset(), getMaxExposureOffset()]);
     if (offset < range[0] || offset > range[1]) {
       throw CameraException(
-        "exposureOffsetOutOfBounds",
-        "The provided exposure offset was outside the supported range for this device.",
+        'exposureOffsetOutOfBounds',
+        'The provided exposure offset was outside the supported range for this device.',
       );
     }
 
     // Round to the closest step if needed
-    double stepSize = await getExposureOffsetStepSize();
+    final double stepSize = await getExposureOffsetStepSize();
     if (stepSize > 0) {
-      double inv = 1.0 / stepSize;
+      final double inv = 1.0 / stepSize;
       double roundedOffset = (offset * inv).roundToDouble() / inv;
       if (roundedOffset > range[1]) {
         roundedOffset = (offset * inv).floorToDouble() / inv;
@@ -743,8 +751,8 @@
       await CameraPlatform.instance.lockCaptureOrientation(
           _cameraId, orientation ?? value.deviceOrientation);
       value = value.copyWith(
-          lockedCaptureOrientation:
-              Optional.fromNullable(orientation ?? value.deviceOrientation));
+          lockedCaptureOrientation: Optional<DeviceOrientation>.fromNullable(
+              orientation ?? value.deviceOrientation));
     } on PlatformException catch (e) {
       throw CameraException(e.code, e.message);
     }
@@ -764,7 +772,8 @@
   Future<void> unlockCaptureOrientation() async {
     try {
       await CameraPlatform.instance.unlockCaptureOrientation(_cameraId);
-      value = value.copyWith(lockedCaptureOrientation: Optional.absent());
+      value = value.copyWith(
+          lockedCaptureOrientation: const Optional<DeviceOrientation>.absent());
     } on PlatformException catch (e) {
       throw CameraException(e.code, e.message);
     }
diff --git a/packages/camera/camera/lib/src/camera_image.dart b/packages/camera/camera/lib/src/camera_image.dart
index 43fa763..fd3a3d6 100644
--- a/packages/camera/camera/lib/src/camera_image.dart
+++ b/packages/camera/camera/lib/src/camera_image.dart
@@ -4,9 +4,9 @@
 
 import 'dart:typed_data';
 
+import 'package:camera_platform_interface/camera_platform_interface.dart';
 import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
-import 'package:camera_platform_interface/camera_platform_interface.dart';
 
 /// A single color plane of image data.
 ///
@@ -14,11 +14,11 @@
 /// format of the Image.
 class Plane {
   Plane._fromPlatformData(Map<dynamic, dynamic> data)
-      : bytes = data['bytes'],
-        bytesPerPixel = data['bytesPerPixel'],
-        bytesPerRow = data['bytesPerRow'],
-        height = data['height'],
-        width = data['width'];
+      : bytes = data['bytes'] as Uint8List,
+        bytesPerPixel = data['bytesPerPixel'] as int?,
+        bytesPerRow = data['bytesPerRow'] as int,
+        height = data['height'] as int?,
+        width = data['width'] as int?;
 
   /// Bytes representing this plane.
   final Uint8List bytes;
@@ -98,13 +98,14 @@
   /// CameraImage Constructor
   CameraImage.fromPlatformData(Map<dynamic, dynamic> data)
       : format = ImageFormat._fromPlatformData(data['format']),
-        height = data['height'],
-        width = data['width'],
-        lensAperture = data['lensAperture'],
-        sensorExposureTime = data['sensorExposureTime'],
-        sensorSensitivity = data['sensorSensitivity'],
-        planes = List<Plane>.unmodifiable(data['planes']
-            .map((dynamic planeData) => Plane._fromPlatformData(planeData)));
+        height = data['height'] as int,
+        width = data['width'] as int,
+        lensAperture = data['lensAperture'] as double?,
+        sensorExposureTime = data['sensorExposureTime'] as int?,
+        sensorSensitivity = data['sensorSensitivity'] as double?,
+        planes = List<Plane>.unmodifiable((data['planes'] as List<dynamic>)
+            .map<Plane>((dynamic planeData) =>
+                Plane._fromPlatformData(planeData as Map<dynamic, dynamic>)));
 
   /// Format of the image provided.
   ///
diff --git a/packages/camera/camera/lib/src/camera_preview.dart b/packages/camera/camera/lib/src/camera_preview.dart
index 5faa69f..a9b3f21 100644
--- a/packages/camera/camera/lib/src/camera_preview.dart
+++ b/packages/camera/camera/lib/src/camera_preview.dart
@@ -21,16 +21,16 @@
   @override
   Widget build(BuildContext context) {
     return controller.value.isInitialized
-        ? ValueListenableBuilder(
+        ? ValueListenableBuilder<CameraValue>(
             valueListenable: controller,
-            builder: (context, value, child) {
+            builder: (BuildContext context, Object? value, Widget? child) {
               return AspectRatio(
                 aspectRatio: _isLandscape()
                     ? controller.value.aspectRatio
                     : (1 / controller.value.aspectRatio),
                 child: Stack(
                   fit: StackFit.expand,
-                  children: [
+                  children: <Widget>[
                     _wrapInRotatedBox(child: controller.buildPreview()),
                     child ?? Container(),
                   ],
@@ -54,12 +54,14 @@
   }
 
   bool _isLandscape() {
-    return [DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]
-        .contains(_getApplicableOrientation());
+    return <DeviceOrientation>[
+      DeviceOrientation.landscapeLeft,
+      DeviceOrientation.landscapeRight
+    ].contains(_getApplicableOrientation());
   }
 
   int _getQuarterTurns() {
-    Map<DeviceOrientation, int> turns = {
+    final Map<DeviceOrientation, int> turns = <DeviceOrientation, int>{
       DeviceOrientation.portraitUp: 0,
       DeviceOrientation.landscapeRight: 1,
       DeviceOrientation.portraitDown: 2,
diff --git a/packages/camera/camera/pubspec.yaml b/packages/camera/camera/pubspec.yaml
index f522608..7421a77 100644
--- a/packages/camera/camera/pubspec.yaml
+++ b/packages/camera/camera/pubspec.yaml
@@ -4,7 +4,7 @@
   Dart.
 repository: https://github.com/flutter/plugins/tree/main/packages/camera/camera
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
-version: 0.9.4+11
+version: 0.9.4+12
 
 environment:
   sdk: ">=2.14.0 <3.0.0"
@@ -26,15 +26,14 @@
   camera_web: ^0.2.1
   flutter:
     sdk: flutter
-  pedantic: ^1.10.0
-  quiver: ^3.0.0
   flutter_plugin_android_lifecycle: ^2.0.2
+  quiver: ^3.0.0
 
 dev_dependencies:
-  flutter_test:
-    sdk: flutter
   flutter_driver:
     sdk: flutter
+  flutter_test:
+    sdk: flutter
   mockito: ^5.0.0
   plugin_platform_interface: ^2.0.0
   video_player: ^2.0.0
diff --git a/packages/camera/camera/test/camera_image_stream_test.dart b/packages/camera/camera/test/camera_image_stream_test.dart
index 840770d..7055b22 100644
--- a/packages/camera/camera/test/camera_image_stream_test.dart
+++ b/packages/camera/camera/test/camera_image_stream_test.dart
@@ -17,24 +17,24 @@
   });
 
   test('startImageStream() throws $CameraException when uninitialized', () {
-    CameraController cameraController = CameraController(
-        CameraDescription(
+    final CameraController cameraController = CameraController(
+        const CameraDescription(
             name: 'cam',
             lensDirection: CameraLensDirection.back,
             sensorOrientation: 90),
         ResolutionPreset.max);
 
     expect(
-      () => cameraController.startImageStream((image) => null),
+      () => cameraController.startImageStream((CameraImage image) => null),
       throwsA(
         isA<CameraException>()
             .having(
-              (error) => error.code,
+              (CameraException error) => error.code,
               'code',
               'Uninitialized CameraController',
             )
             .having(
-              (error) => error.description,
+              (CameraException error) => error.description,
               'description',
               'startImageStream() was called on an uninitialized CameraController.',
             ),
@@ -44,8 +44,8 @@
 
   test('startImageStream() throws $CameraException when recording videos',
       () async {
-    CameraController cameraController = CameraController(
-        CameraDescription(
+    final CameraController cameraController = CameraController(
+        const CameraDescription(
             name: 'cam',
             lensDirection: CameraLensDirection.back,
             sensorOrientation: 90),
@@ -57,9 +57,9 @@
         cameraController.value.copyWith(isRecordingVideo: true);
 
     expect(
-        () => cameraController.startImageStream((image) => null),
+        () => cameraController.startImageStream((CameraImage image) => null),
         throwsA(isA<CameraException>().having(
-          (error) => error.description,
+          (CameraException error) => error.description,
           'A video recording is already started.',
           'startImageStream was called while a video is being recorded.',
         )));
@@ -67,8 +67,8 @@
   test(
       'startImageStream() throws $CameraException when already streaming images',
       () async {
-    CameraController cameraController = CameraController(
-        CameraDescription(
+    final CameraController cameraController = CameraController(
+        const CameraDescription(
             name: 'cam',
             lensDirection: CameraLensDirection.back,
             sensorOrientation: 90),
@@ -78,31 +78,31 @@
     cameraController.value =
         cameraController.value.copyWith(isStreamingImages: true);
     expect(
-        () => cameraController.startImageStream((image) => null),
+        () => cameraController.startImageStream((CameraImage image) => null),
         throwsA(isA<CameraException>().having(
-          (error) => error.description,
+          (CameraException error) => error.description,
           'A camera has started streaming images.',
           'startImageStream was called while a camera was streaming images.',
         )));
   });
 
   test('startImageStream() calls CameraPlatform', () async {
-    MethodChannelMock cameraChannelMock = MethodChannelMock(
+    final MethodChannelMock cameraChannelMock = MethodChannelMock(
         channelName: 'plugins.flutter.io/camera',
-        methods: {'startImageStream': {}});
-    MethodChannelMock streamChannelMock = MethodChannelMock(
+        methods: <String, dynamic>{'startImageStream': <String, dynamic>{}});
+    final MethodChannelMock streamChannelMock = MethodChannelMock(
         channelName: 'plugins.flutter.io/camera/imageStream',
-        methods: {'listen': {}});
+        methods: <String, dynamic>{'listen': <String, dynamic>{}});
 
-    CameraController cameraController = CameraController(
-        CameraDescription(
+    final CameraController cameraController = CameraController(
+        const CameraDescription(
             name: 'cam',
             lensDirection: CameraLensDirection.back,
             sensorOrientation: 90),
         ResolutionPreset.max);
     await cameraController.initialize();
 
-    await cameraController.startImageStream((image) => null);
+    await cameraController.startImageStream((CameraImage image) => null);
 
     expect(cameraChannelMock.log,
         <Matcher>[isMethodCall('startImageStream', arguments: null)]);
@@ -111,8 +111,8 @@
   });
 
   test('stopImageStream() throws $CameraException when uninitialized', () {
-    CameraController cameraController = CameraController(
-        CameraDescription(
+    final CameraController cameraController = CameraController(
+        const CameraDescription(
             name: 'cam',
             lensDirection: CameraLensDirection.back,
             sensorOrientation: 90),
@@ -123,12 +123,12 @@
       throwsA(
         isA<CameraException>()
             .having(
-              (error) => error.code,
+              (CameraException error) => error.code,
               'code',
               'Uninitialized CameraController',
             )
             .having(
-              (error) => error.description,
+              (CameraException error) => error.description,
               'description',
               'stopImageStream() was called on an uninitialized CameraController.',
             ),
@@ -138,21 +138,21 @@
 
   test('stopImageStream() throws $CameraException when recording videos',
       () async {
-    CameraController cameraController = CameraController(
-        CameraDescription(
+    final CameraController cameraController = CameraController(
+        const CameraDescription(
             name: 'cam',
             lensDirection: CameraLensDirection.back,
             sensorOrientation: 90),
         ResolutionPreset.max);
     await cameraController.initialize();
 
-    await cameraController.startImageStream((image) => null);
+    await cameraController.startImageStream((CameraImage image) => null);
     cameraController.value =
         cameraController.value.copyWith(isRecordingVideo: true);
     expect(
         cameraController.stopImageStream,
         throwsA(isA<CameraException>().having(
-          (error) => error.description,
+          (CameraException error) => error.description,
           'A video recording is already started.',
           'stopImageStream was called while a video is being recorded.',
         )));
@@ -160,8 +160,8 @@
 
   test('stopImageStream() throws $CameraException when not streaming images',
       () async {
-    CameraController cameraController = CameraController(
-        CameraDescription(
+    final CameraController cameraController = CameraController(
+        const CameraDescription(
             name: 'cam',
             lensDirection: CameraLensDirection.back,
             sensorOrientation: 90),
@@ -171,28 +171,34 @@
     expect(
         cameraController.stopImageStream,
         throwsA(isA<CameraException>().having(
-          (error) => error.description,
+          (CameraException error) => error.description,
           'No camera is streaming images',
           'stopImageStream was called when no camera is streaming images.',
         )));
   });
 
   test('stopImageStream() intended behaviour', () async {
-    MethodChannelMock cameraChannelMock = MethodChannelMock(
+    final MethodChannelMock cameraChannelMock = MethodChannelMock(
         channelName: 'plugins.flutter.io/camera',
-        methods: {'startImageStream': {}, 'stopImageStream': {}});
-    MethodChannelMock streamChannelMock = MethodChannelMock(
+        methods: <String, dynamic>{
+          'startImageStream': <String, dynamic>{},
+          'stopImageStream': <String, dynamic>{}
+        });
+    final MethodChannelMock streamChannelMock = MethodChannelMock(
         channelName: 'plugins.flutter.io/camera/imageStream',
-        methods: {'listen': {}, 'cancel': {}});
+        methods: <String, dynamic>{
+          'listen': <String, dynamic>{},
+          'cancel': <String, dynamic>{}
+        });
 
-    CameraController cameraController = CameraController(
-        CameraDescription(
+    final CameraController cameraController = CameraController(
+        const CameraDescription(
             name: 'cam',
             lensDirection: CameraLensDirection.back,
             sensorOrientation: 90),
         ResolutionPreset.max);
     await cameraController.initialize();
-    await cameraController.startImageStream((image) => null);
+    await cameraController.startImageStream((CameraImage image) => null);
     await cameraController.stopImageStream();
 
     expect(cameraChannelMock.log, <Matcher>[
diff --git a/packages/camera/camera/test/camera_image_test.dart b/packages/camera/camera/test/camera_image_test.dart
index 85d613f..b09a141 100644
--- a/packages/camera/camera/test/camera_image_test.dart
+++ b/packages/camera/camera/test/camera_image_test.dart
@@ -14,16 +14,17 @@
   group('$CameraImage tests', () {
     test('$CameraImage can be created', () {
       debugDefaultTargetPlatformOverride = TargetPlatform.android;
-      CameraImage cameraImage = CameraImage.fromPlatformData(<dynamic, dynamic>{
+      final CameraImage cameraImage =
+          CameraImage.fromPlatformData(<dynamic, dynamic>{
         'format': 35,
         'height': 1,
         'width': 4,
         'lensAperture': 1.8,
         'sensorExposureTime': 9991324,
         'sensorSensitivity': 92.0,
-        'planes': [
-          {
-            'bytes': Uint8List.fromList([1, 2, 3, 4]),
+        'planes': <dynamic>[
+          <dynamic, dynamic>{
+            'bytes': Uint8List.fromList(<int>[1, 2, 3, 4]),
             'bytesPerPixel': 1,
             'bytesPerRow': 4,
             'height': 1,
@@ -40,16 +41,17 @@
     test('$CameraImage has ImageFormatGroup.yuv420 for iOS', () {
       debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
 
-      CameraImage cameraImage = CameraImage.fromPlatformData(<dynamic, dynamic>{
+      final CameraImage cameraImage =
+          CameraImage.fromPlatformData(<dynamic, dynamic>{
         'format': 875704438,
         'height': 1,
         'width': 4,
         'lensAperture': 1.8,
         'sensorExposureTime': 9991324,
         'sensorSensitivity': 92.0,
-        'planes': [
-          {
-            'bytes': Uint8List.fromList([1, 2, 3, 4]),
+        'planes': <dynamic>[
+          <dynamic, dynamic>{
+            'bytes': Uint8List.fromList(<int>[1, 2, 3, 4]),
             'bytesPerPixel': 1,
             'bytesPerRow': 4,
             'height': 1,
@@ -63,16 +65,17 @@
     test('$CameraImage has ImageFormatGroup.yuv420 for Android', () {
       debugDefaultTargetPlatformOverride = TargetPlatform.android;
 
-      CameraImage cameraImage = CameraImage.fromPlatformData(<dynamic, dynamic>{
+      final CameraImage cameraImage =
+          CameraImage.fromPlatformData(<dynamic, dynamic>{
         'format': 35,
         'height': 1,
         'width': 4,
         'lensAperture': 1.8,
         'sensorExposureTime': 9991324,
         'sensorSensitivity': 92.0,
-        'planes': [
-          {
-            'bytes': Uint8List.fromList([1, 2, 3, 4]),
+        'planes': <dynamic>[
+          <dynamic, dynamic>{
+            'bytes': Uint8List.fromList(<int>[1, 2, 3, 4]),
             'bytesPerPixel': 1,
             'bytesPerRow': 4,
             'height': 1,
@@ -86,16 +89,17 @@
     test('$CameraImage has ImageFormatGroup.bgra8888 for iOS', () {
       debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
 
-      CameraImage cameraImage = CameraImage.fromPlatformData(<dynamic, dynamic>{
+      final CameraImage cameraImage =
+          CameraImage.fromPlatformData(<dynamic, dynamic>{
         'format': 1111970369,
         'height': 1,
         'width': 4,
         'lensAperture': 1.8,
         'sensorExposureTime': 9991324,
         'sensorSensitivity': 92.0,
-        'planes': [
-          {
-            'bytes': Uint8List.fromList([1, 2, 3, 4]),
+        'planes': <dynamic>[
+          <dynamic, dynamic>{
+            'bytes': Uint8List.fromList(<int>[1, 2, 3, 4]),
             'bytesPerPixel': 1,
             'bytesPerRow': 4,
             'height': 1,
@@ -106,16 +110,17 @@
       expect(cameraImage.format.group, ImageFormatGroup.bgra8888);
     });
     test('$CameraImage has ImageFormatGroup.unknown', () {
-      CameraImage cameraImage = CameraImage.fromPlatformData(<dynamic, dynamic>{
+      final CameraImage cameraImage =
+          CameraImage.fromPlatformData(<dynamic, dynamic>{
         'format': null,
         'height': 1,
         'width': 4,
         'lensAperture': 1.8,
         'sensorExposureTime': 9991324,
         'sensorSensitivity': 92.0,
-        'planes': [
-          {
-            'bytes': Uint8List.fromList([1, 2, 3, 4]),
+        'planes': <dynamic>[
+          <dynamic, dynamic>{
+            'bytes': Uint8List.fromList(<int>[1, 2, 3, 4]),
             'bytesPerPixel': 1,
             'bytesPerRow': 4,
             'height': 1,
diff --git a/packages/camera/camera/test/camera_preview_test.dart b/packages/camera/camera/test/camera_preview_test.dart
index 32718f4..76bfe40 100644
--- a/packages/camera/camera/test/camera_preview_test.dart
+++ b/packages/camera/camera/test/camera_preview_test.dart
@@ -23,7 +23,7 @@
 
   @override
   Widget buildPreview() {
-    return Texture(textureId: CameraController.kUninitializedCameraId);
+    return const Texture(textureId: CameraController.kUninitializedCameraId);
   }
 
   @override
@@ -33,7 +33,7 @@
   void debugCheckIsDisposed() {}
 
   @override
-  CameraDescription get description => CameraDescription(
+  CameraDescription get description => const CameraDescription(
       name: '', lensDirection: CameraLensDirection.back, sensorOrientation: 0);
 
   @override
@@ -97,7 +97,7 @@
   Future<void> setZoomLevel(double zoom) async {}
 
   @override
-  Future<void> startImageStream(onAvailable) async {}
+  Future<void> startImageStream(onLatestImageAvailable onAvailable) async {}
 
   @override
   Future<void> startVideoRecording() async {}
@@ -136,10 +136,11 @@
         isRecordingVideo: true,
         deviceOrientation: DeviceOrientation.portraitUp,
         lockedCaptureOrientation:
-            Optional.fromNullable(DeviceOrientation.landscapeRight),
-        recordingOrientation:
-            Optional.fromNullable(DeviceOrientation.landscapeLeft),
-        previewSize: Size(480, 640),
+            const Optional<DeviceOrientation>.fromNullable(
+                DeviceOrientation.landscapeRight),
+        recordingOrientation: const Optional<DeviceOrientation>.fromNullable(
+            DeviceOrientation.landscapeLeft),
+        previewSize: const Size(480, 640),
       );
 
       await tester.pumpWidget(
@@ -150,7 +151,7 @@
       );
       expect(find.byType(RotatedBox), findsOneWidget);
 
-      RotatedBox rotatedBox =
+      final RotatedBox rotatedBox =
           tester.widget<RotatedBox>(find.byType(RotatedBox));
       expect(rotatedBox.quarterTurns, 3);
 
@@ -169,10 +170,11 @@
         isInitialized: true,
         deviceOrientation: DeviceOrientation.portraitUp,
         lockedCaptureOrientation:
-            Optional.fromNullable(DeviceOrientation.landscapeRight),
-        recordingOrientation:
-            Optional.fromNullable(DeviceOrientation.landscapeLeft),
-        previewSize: Size(480, 640),
+            const Optional<DeviceOrientation>.fromNullable(
+                DeviceOrientation.landscapeRight),
+        recordingOrientation: const Optional<DeviceOrientation>.fromNullable(
+            DeviceOrientation.landscapeLeft),
+        previewSize: const Size(480, 640),
       );
 
       await tester.pumpWidget(
@@ -183,7 +185,7 @@
       );
       expect(find.byType(RotatedBox), findsOneWidget);
 
-      RotatedBox rotatedBox =
+      final RotatedBox rotatedBox =
           tester.widget<RotatedBox>(find.byType(RotatedBox));
       expect(rotatedBox.quarterTurns, 1);
 
@@ -202,9 +204,9 @@
         isInitialized: true,
         deviceOrientation: DeviceOrientation.portraitUp,
         lockedCaptureOrientation: null,
-        recordingOrientation:
-            Optional.fromNullable(DeviceOrientation.landscapeLeft),
-        previewSize: Size(480, 640),
+        recordingOrientation: const Optional<DeviceOrientation>.fromNullable(
+            DeviceOrientation.landscapeLeft),
+        previewSize: const Size(480, 640),
       );
 
       await tester.pumpWidget(
@@ -215,7 +217,7 @@
       );
       expect(find.byType(RotatedBox), findsOneWidget);
 
-      RotatedBox rotatedBox =
+      final RotatedBox rotatedBox =
           tester.widget<RotatedBox>(find.byType(RotatedBox));
       expect(rotatedBox.quarterTurns, 0);
 
@@ -229,7 +231,7 @@
     final FakeController controller = FakeController();
     controller.value = controller.value.copyWith(
       isInitialized: true,
-      previewSize: Size(480, 640),
+      previewSize: const Size(480, 640),
     );
 
     await tester.pumpWidget(
diff --git a/packages/camera/camera/test/camera_test.dart b/packages/camera/camera/test/camera_test.dart
index 6904e68..c4e0c93 100644
--- a/packages/camera/camera/test/camera_test.dart
+++ b/packages/camera/camera/test/camera_test.dart
@@ -15,20 +15,21 @@
 import 'package:mockito/mockito.dart';
 import 'package:plugin_platform_interface/plugin_platform_interface.dart';
 
-get mockAvailableCameras => [
-      CameraDescription(
+List<CameraDescription> get mockAvailableCameras => <CameraDescription>[
+      const CameraDescription(
           name: 'camBack',
           lensDirection: CameraLensDirection.back,
           sensorOrientation: 90),
-      CameraDescription(
+      const CameraDescription(
           name: 'camFront',
           lensDirection: CameraLensDirection.front,
           sensorOrientation: 180),
     ];
 
-get mockInitializeCamera => 13;
+int get mockInitializeCamera => 13;
 
-get mockOnCameraInitializedEvent => CameraInitializedEvent(
+CameraInitializedEvent get mockOnCameraInitializedEvent =>
+    const CameraInitializedEvent(
       13,
       75,
       75,
@@ -38,16 +39,17 @@
       true,
     );
 
-get mockOnDeviceOrientationChangedEvent =>
-    DeviceOrientationChangedEvent(DeviceOrientation.portraitUp);
+DeviceOrientationChangedEvent get mockOnDeviceOrientationChangedEvent =>
+    const DeviceOrientationChangedEvent(DeviceOrientation.portraitUp);
 
-get mockOnCameraClosingEvent => null;
+CameraClosingEvent get mockOnCameraClosingEvent => const CameraClosingEvent(13);
 
-get mockOnCameraErrorEvent => CameraErrorEvent(13, 'closing');
+CameraErrorEvent get mockOnCameraErrorEvent =>
+    const CameraErrorEvent(13, 'closing');
 
 XFile mockTakePicture = XFile('foo/bar.png');
 
-get mockVideoRecordingXFile => null;
+XFile mockVideoRecordingXFile = XFile('foo/bar.mpeg');
 
 bool mockPlatformException = false;
 
@@ -57,7 +59,7 @@
   group('camera', () {
     test('debugCheckIsDisposed should not throw assertion error when disposed',
         () {
-      final MockCameraDescription description = MockCameraDescription();
+      const MockCameraDescription description = MockCameraDescription();
       final CameraController controller = CameraController(
         description,
         ResolutionPreset.low,
@@ -70,7 +72,7 @@
 
     test('debugCheckIsDisposed should throw assertion error when not disposed',
         () {
-      final MockCameraDescription description = MockCameraDescription();
+      const MockCameraDescription description = MockCameraDescription();
       final CameraController controller = CameraController(
         description,
         ResolutionPreset.low,
@@ -85,7 +87,7 @@
     test('availableCameras() has camera', () async {
       CameraPlatform.instance = MockCameraPlatform();
 
-      var camList = await availableCameras();
+      final List<CameraDescription> camList = await availableCameras();
 
       expect(camList, equals(mockAvailableCameras));
     });
@@ -97,8 +99,8 @@
     });
 
     test('Can be initialized', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -106,13 +108,13 @@
       await cameraController.initialize();
 
       expect(cameraController.value.aspectRatio, 1);
-      expect(cameraController.value.previewSize, Size(75, 75));
+      expect(cameraController.value.previewSize, const Size(75, 75));
       expect(cameraController.value.isInitialized, isTrue);
     });
 
     test('can be disposed', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -120,7 +122,7 @@
       await cameraController.initialize();
 
       expect(cameraController.value.aspectRatio, 1);
-      expect(cameraController.value.previewSize, Size(75, 75));
+      expect(cameraController.value.previewSize, const Size(75, 75));
       expect(cameraController.value.isInitialized, isTrue);
 
       await cameraController.dispose();
@@ -129,8 +131,8 @@
     });
 
     test('initialize() throws CameraException when disposed', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -138,7 +140,7 @@
       await cameraController.initialize();
 
       expect(cameraController.value.aspectRatio, 1);
-      expect(cameraController.value.previewSize, Size(75, 75));
+      expect(cameraController.value.previewSize, const Size(75, 75));
       expect(cameraController.value.isInitialized, isTrue);
 
       await cameraController.dispose();
@@ -148,7 +150,7 @@
       expect(
           cameraController.initialize,
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'Error description',
             'initialize was called on a disposed CameraController',
           )));
@@ -156,8 +158,8 @@
 
     test('initialize() throws $CameraException on $PlatformException ',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -168,7 +170,7 @@
       expect(
           cameraController.initialize,
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'foo',
             'bar',
           )));
@@ -177,8 +179,8 @@
 
     test('initialize() sets imageFormat', () async {
       debugDefaultTargetPlatformOverride = TargetPlatform.android;
-      CameraController cameraController = CameraController(
-        CameraDescription(
+      final CameraController cameraController = CameraController(
+        const CameraDescription(
             name: 'cam',
             lensDirection: CameraLensDirection.back,
             sensorOrientation: 90),
@@ -192,8 +194,8 @@
     });
 
     test('prepareForVideoRecording() calls $CameraPlatform ', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -206,8 +208,8 @@
     });
 
     test('takePicture() throws $CameraException when uninitialized ', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -217,12 +219,12 @@
         throwsA(
           isA<CameraException>()
               .having(
-                (error) => error.code,
+                (CameraException error) => error.code,
                 'code',
                 'Uninitialized CameraController',
               )
               .having(
-                (error) => error.description,
+                (CameraException error) => error.description,
                 'description',
                 'takePicture() was called on an uninitialized CameraController.',
               ),
@@ -232,8 +234,8 @@
 
     test('takePicture() throws $CameraException when takePicture is true',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -245,29 +247,29 @@
       expect(
           cameraController.takePicture(),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'Previous capture has not returned yet.',
             'takePicture was called before the previous capture returned.',
           )));
     });
 
     test('takePicture() returns $XFile', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
           ResolutionPreset.max);
       await cameraController.initialize();
-      XFile xFile = await cameraController.takePicture();
+      final XFile xFile = await cameraController.takePicture();
 
       expect(xFile.path, mockTakePicture.path);
     });
 
     test('takePicture() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -278,7 +280,7 @@
       expect(
           cameraController.takePicture(),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'foo',
             'bar',
           )));
@@ -287,8 +289,8 @@
 
     test('startVideoRecording() throws $CameraException when uninitialized',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -299,12 +301,12 @@
         throwsA(
           isA<CameraException>()
               .having(
-                (error) => error.code,
+                (CameraException error) => error.code,
                 'code',
                 'Uninitialized CameraController',
               )
               .having(
-                (error) => error.description,
+                (CameraException error) => error.description,
                 'description',
                 'startVideoRecording() was called on an uninitialized CameraController.',
               ),
@@ -313,8 +315,8 @@
     });
     test('startVideoRecording() throws $CameraException when recording videos',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -328,7 +330,7 @@
       expect(
           cameraController.startVideoRecording(),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'A video recording is already started.',
             'startVideoRecording was called when a recording is already started.',
           )));
@@ -337,8 +339,8 @@
     test(
         'startVideoRecording() throws $CameraException when already streaming images',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -352,7 +354,7 @@
       expect(
           cameraController.startVideoRecording(),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'A camera has started streaming images.',
             'startVideoRecording was called while a camera was streaming images.',
           )));
@@ -360,8 +362,8 @@
 
     test('getMaxZoomLevel() throws $CameraException when uninitialized',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -372,12 +374,12 @@
         throwsA(
           isA<CameraException>()
               .having(
-                (error) => error.code,
+                (CameraException error) => error.code,
                 'code',
                 'Uninitialized CameraController',
               )
               .having(
-                (error) => error.description,
+                (CameraException error) => error.description,
                 'description',
                 'getMaxZoomLevel() was called on an uninitialized CameraController.',
               ),
@@ -386,8 +388,8 @@
     });
 
     test('getMaxZoomLevel() throws $CameraException when disposed', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -401,12 +403,12 @@
         throwsA(
           isA<CameraException>()
               .having(
-                (error) => error.code,
+                (CameraException error) => error.code,
                 'code',
                 'Disposed CameraController',
               )
               .having(
-                (error) => error.description,
+                (CameraException error) => error.description,
                 'description',
                 'getMaxZoomLevel() was called on a disposed CameraController.',
               ),
@@ -417,8 +419,8 @@
     test(
         'getMaxZoomLevel() throws $CameraException when a platform exception occured.',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -434,17 +436,18 @@
       expect(
           cameraController.getMaxZoomLevel,
           throwsA(isA<CameraException>()
-              .having((error) => error.code, 'code', 'TEST_ERROR')
               .having(
-                (error) => error.description,
+                  (CameraException error) => error.code, 'code', 'TEST_ERROR')
+              .having(
+                (CameraException error) => error.description,
                 'description',
                 'This is a test error messge',
               )));
     });
 
     test('getMaxZoomLevel() returns max zoom level.', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -452,16 +455,16 @@
 
       await cameraController.initialize();
       when(CameraPlatform.instance.getMaxZoomLevel(mockInitializeCamera))
-          .thenAnswer((_) => Future.value(42.0));
+          .thenAnswer((_) => Future<double>.value(42.0));
 
-      final maxZoomLevel = await cameraController.getMaxZoomLevel();
+      final double maxZoomLevel = await cameraController.getMaxZoomLevel();
       expect(maxZoomLevel, 42.0);
     });
 
     test('getMinZoomLevel() throws $CameraException when uninitialized',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -472,12 +475,12 @@
         throwsA(
           isA<CameraException>()
               .having(
-                (error) => error.code,
+                (CameraException error) => error.code,
                 'code',
                 'Uninitialized CameraController',
               )
               .having(
-                (error) => error.description,
+                (CameraException error) => error.description,
                 'description',
                 'getMinZoomLevel() was called on an uninitialized CameraController.',
               ),
@@ -486,8 +489,8 @@
     });
 
     test('getMinZoomLevel() throws $CameraException when disposed', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -501,12 +504,12 @@
         throwsA(
           isA<CameraException>()
               .having(
-                (error) => error.code,
+                (CameraException error) => error.code,
                 'code',
                 'Disposed CameraController',
               )
               .having(
-                (error) => error.description,
+                (CameraException error) => error.description,
                 'description',
                 'getMinZoomLevel() was called on a disposed CameraController.',
               ),
@@ -517,8 +520,8 @@
     test(
         'getMinZoomLevel() throws $CameraException when a platform exception occured.',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -534,17 +537,18 @@
       expect(
           cameraController.getMinZoomLevel,
           throwsA(isA<CameraException>()
-              .having((error) => error.code, 'code', 'TEST_ERROR')
               .having(
-                (error) => error.description,
+                  (CameraException error) => error.code, 'code', 'TEST_ERROR')
+              .having(
+                (CameraException error) => error.description,
                 'description',
                 'This is a test error messge',
               )));
     });
 
     test('getMinZoomLevel() returns max zoom level.', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -552,15 +556,15 @@
 
       await cameraController.initialize();
       when(CameraPlatform.instance.getMinZoomLevel(mockInitializeCamera))
-          .thenAnswer((_) => Future.value(42.0));
+          .thenAnswer((_) => Future<double>.value(42.0));
 
-      final maxZoomLevel = await cameraController.getMinZoomLevel();
+      final double maxZoomLevel = await cameraController.getMinZoomLevel();
       expect(maxZoomLevel, 42.0);
     });
 
     test('setZoomLevel() throws $CameraException when uninitialized', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -571,12 +575,12 @@
         throwsA(
           isA<CameraException>()
               .having(
-                (error) => error.code,
+                (CameraException error) => error.code,
                 'code',
                 'Uninitialized CameraController',
               )
               .having(
-                (error) => error.description,
+                (CameraException error) => error.description,
                 'description',
                 'setZoomLevel() was called on an uninitialized CameraController.',
               ),
@@ -585,8 +589,8 @@
     });
 
     test('setZoomLevel() throws $CameraException when disposed', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -600,12 +604,12 @@
         throwsA(
           isA<CameraException>()
               .having(
-                (error) => error.code,
+                (CameraException error) => error.code,
                 'code',
                 'Disposed CameraController',
               )
               .having(
-                (error) => error.description,
+                (CameraException error) => error.description,
                 'description',
                 'setZoomLevel() was called on a disposed CameraController.',
               ),
@@ -616,8 +620,8 @@
     test(
         'setZoomLevel() throws $CameraException when a platform exception occured.',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -633,9 +637,10 @@
       expect(
           () => cameraController.setZoomLevel(42),
           throwsA(isA<CameraException>()
-              .having((error) => error.code, 'code', 'TEST_ERROR')
               .having(
-                (error) => error.description,
+                  (CameraException error) => error.code, 'code', 'TEST_ERROR')
+              .having(
+                (CameraException error) => error.description,
                 'description',
                 'This is a test error messge',
               )));
@@ -646,8 +651,8 @@
     test(
         'setZoomLevel() completes and calls method channel with correct value.',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -661,8 +666,8 @@
     });
 
     test('setFlashMode() calls $CameraPlatform', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -678,8 +683,8 @@
 
     test('setFlashMode() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -699,15 +704,15 @@
       expect(
           cameraController.setFlashMode(FlashMode.always),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'TEST_ERROR',
             'This is a test error message',
           )));
     });
 
     test('setExposureMode() calls $CameraPlatform', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -723,8 +728,8 @@
 
     test('setExposureMode() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -744,32 +749,32 @@
       expect(
           cameraController.setExposureMode(ExposureMode.auto),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'TEST_ERROR',
             'This is a test error message',
           )));
     });
 
     test('setExposurePoint() calls $CameraPlatform', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
           ResolutionPreset.max);
       await cameraController.initialize();
 
-      await cameraController.setExposurePoint(Offset(0.5, 0.5));
+      await cameraController.setExposurePoint(const Offset(0.5, 0.5));
 
       verify(CameraPlatform.instance.setExposurePoint(
-              cameraController.cameraId, Point<double>(0.5, 0.5)))
+              cameraController.cameraId, const Point<double>(0.5, 0.5)))
           .called(1);
     });
 
     test('setExposurePoint() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -777,7 +782,7 @@
       await cameraController.initialize();
 
       when(CameraPlatform.instance.setExposurePoint(
-              cameraController.cameraId, Point<double>(0.5, 0.5)))
+              cameraController.cameraId, const Point<double>(0.5, 0.5)))
           .thenThrow(
         PlatformException(
           code: 'TEST_ERROR',
@@ -787,17 +792,17 @@
       );
 
       expect(
-          cameraController.setExposurePoint(Offset(0.5, 0.5)),
+          cameraController.setExposurePoint(const Offset(0.5, 0.5)),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'TEST_ERROR',
             'This is a test error message',
           )));
     });
 
     test('getMinExposureOffset() calls $CameraPlatform', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -806,7 +811,7 @@
 
       when(CameraPlatform.instance
               .getMinExposureOffset(cameraController.cameraId))
-          .thenAnswer((_) => Future.value(0.0));
+          .thenAnswer((_) => Future<double>.value(0.0));
 
       await cameraController.getMinExposureOffset();
 
@@ -817,8 +822,8 @@
 
     test('getMinExposureOffset() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -837,15 +842,15 @@
       expect(
           cameraController.getMinExposureOffset(),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'TEST_ERROR',
             'This is a test error message',
           )));
     });
 
     test('getMaxExposureOffset() calls $CameraPlatform', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -854,7 +859,7 @@
 
       when(CameraPlatform.instance
               .getMaxExposureOffset(cameraController.cameraId))
-          .thenAnswer((_) => Future.value(1.0));
+          .thenAnswer((_) => Future<double>.value(1.0));
 
       await cameraController.getMaxExposureOffset();
 
@@ -865,8 +870,8 @@
 
     test('getMaxExposureOffset() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -885,15 +890,15 @@
       expect(
           cameraController.getMaxExposureOffset(),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'TEST_ERROR',
             'This is a test error message',
           )));
     });
 
     test('getExposureOffsetStepSize() calls $CameraPlatform', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -902,7 +907,7 @@
 
       when(CameraPlatform.instance
               .getExposureOffsetStepSize(cameraController.cameraId))
-          .thenAnswer((_) => Future.value(0.0));
+          .thenAnswer((_) => Future<double>.value(0.0));
 
       await cameraController.getExposureOffsetStepSize();
 
@@ -914,8 +919,8 @@
     test(
         'getExposureOffsetStepSize() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -934,15 +939,15 @@
       expect(
           cameraController.getExposureOffsetStepSize(),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'TEST_ERROR',
             'This is a test error message',
           )));
     });
 
     test('setExposureOffset() calls $CameraPlatform', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -970,8 +975,8 @@
 
     test('setExposureOffset() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -998,7 +1003,7 @@
       expect(
           cameraController.setExposureOffset(1.0),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'TEST_ERROR',
             'This is a test error message',
           )));
@@ -1007,8 +1012,8 @@
     test(
         'setExposureOffset() throws $CameraException when offset is out of bounds',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1036,14 +1041,14 @@
       expect(
           cameraController.setExposureOffset(3.0),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'exposureOffsetOutOfBounds',
             'The provided exposure offset was outside the supported range for this device.',
           )));
       expect(
           cameraController.setExposureOffset(-2.0),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'exposureOffsetOutOfBounds',
             'The provided exposure offset was outside the supported range for this device.',
           )));
@@ -1064,8 +1069,8 @@
     });
 
     test('setExposureOffset() rounds offset to nearest step', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1138,8 +1143,8 @@
     });
 
     test('pausePreview() calls $CameraPlatform', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1159,8 +1164,8 @@
 
     test('pausePreview() does not call $CameraPlatform when already paused',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1178,8 +1183,8 @@
 
     test('pausePreview() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1197,15 +1202,15 @@
       expect(
           cameraController.pausePreview(),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'TEST_ERROR',
             'This is a test error message',
           )));
     });
 
     test('resumePreview() calls $CameraPlatform', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1223,8 +1228,8 @@
 
     test('resumePreview() does not call $CameraPlatform when not paused',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1242,8 +1247,8 @@
 
     test('resumePreview() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1263,15 +1268,15 @@
       expect(
           cameraController.resumePreview(),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'TEST_ERROR',
             'This is a test error message',
           )));
     });
 
     test('lockCaptureOrientation() calls $CameraPlatform', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1297,8 +1302,8 @@
     test(
         'lockCaptureOrientation() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1317,15 +1322,15 @@
       expect(
           cameraController.lockCaptureOrientation(DeviceOrientation.portraitUp),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'TEST_ERROR',
             'This is a test error message',
           )));
     });
 
     test('unlockCaptureOrientation() calls $CameraPlatform', () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1343,8 +1348,8 @@
     test(
         'unlockCaptureOrientation() throws $CameraException on $PlatformException',
         () async {
-      CameraController cameraController = CameraController(
-          CameraDescription(
+      final CameraController cameraController = CameraController(
+          const CameraDescription(
               name: 'cam',
               lensDirection: CameraLensDirection.back,
               sensorOrientation: 90),
@@ -1363,7 +1368,7 @@
       expect(
           cameraController.unlockCaptureOrientation(),
           throwsA(isA<CameraException>().having(
-            (error) => error.description,
+            (CameraException error) => error.description,
             'TEST_ERROR',
             'This is a test error message',
           )));
@@ -1381,20 +1386,20 @@
   }) async =>
       super.noSuchMethod(Invocation.method(
         #initializeCamera,
-        [cameraId],
-        {
+        <Object?>[cameraId],
+        <Symbol, dynamic>{
           #imageFormatGroup: imageFormatGroup,
         },
       ));
 
   @override
   Future<void> dispose(int? cameraId) async {
-    return super.noSuchMethod(Invocation.method(#dispose, [cameraId]));
+    return super.noSuchMethod(Invocation.method(#dispose, <Object?>[cameraId]));
   }
 
   @override
   Future<List<CameraDescription>> availableCameras() =>
-      Future.value(mockAvailableCameras);
+      Future<List<CameraDescription>>.value(mockAvailableCameras);
 
   @override
   Future<int> createCamera(
@@ -1404,28 +1409,29 @@
   }) =>
       mockPlatformException
           ? throw PlatformException(code: 'foo', message: 'bar')
-          : Future.value(mockInitializeCamera);
+          : Future<int>.value(mockInitializeCamera);
 
   @override
   Stream<CameraInitializedEvent> onCameraInitialized(int cameraId) =>
-      Stream.value(mockOnCameraInitializedEvent);
+      Stream<CameraInitializedEvent>.value(mockOnCameraInitializedEvent);
 
   @override
   Stream<CameraClosingEvent> onCameraClosing(int cameraId) =>
-      Stream.value(mockOnCameraClosingEvent);
+      Stream<CameraClosingEvent>.value(mockOnCameraClosingEvent);
 
   @override
   Stream<CameraErrorEvent> onCameraError(int cameraId) =>
-      Stream.value(mockOnCameraErrorEvent);
+      Stream<CameraErrorEvent>.value(mockOnCameraErrorEvent);
 
   @override
   Stream<DeviceOrientationChangedEvent> onDeviceOrientationChanged() =>
-      Stream.value(mockOnDeviceOrientationChangedEvent);
+      Stream<DeviceOrientationChangedEvent>.value(
+          mockOnDeviceOrientationChangedEvent);
 
   @override
   Future<XFile> takePicture(int cameraId) => mockPlatformException
       ? throw PlatformException(code: 'foo', message: 'bar')
-      : Future.value(mockTakePicture);
+      : Future<XFile>.value(mockTakePicture);
 
   @override
   Future<void> prepareForVideoRecording() async =>
@@ -1434,87 +1440,91 @@
   @override
   Future<XFile> startVideoRecording(int cameraId,
           {Duration? maxVideoDuration}) =>
-      Future.value(mockVideoRecordingXFile);
+      Future<XFile>.value(mockVideoRecordingXFile);
 
   @override
   Future<void> lockCaptureOrientation(
           int? cameraId, DeviceOrientation? orientation) async =>
-      super.noSuchMethod(
-          Invocation.method(#lockCaptureOrientation, [cameraId, orientation]));
+      super.noSuchMethod(Invocation.method(
+          #lockCaptureOrientation, <Object?>[cameraId, orientation]));
 
   @override
-  Future<void> unlockCaptureOrientation(int? cameraId) async => super
-      .noSuchMethod(Invocation.method(#unlockCaptureOrientation, [cameraId]));
+  Future<void> unlockCaptureOrientation(int? cameraId) async =>
+      super.noSuchMethod(
+          Invocation.method(#unlockCaptureOrientation, <Object?>[cameraId]));
 
   @override
   Future<void> pausePreview(int? cameraId) async =>
-      super.noSuchMethod(Invocation.method(#pausePreview, [cameraId]));
+      super.noSuchMethod(Invocation.method(#pausePreview, <Object?>[cameraId]));
 
   @override
-  Future<void> resumePreview(int? cameraId) async =>
-      super.noSuchMethod(Invocation.method(#resumePreview, [cameraId]));
+  Future<void> resumePreview(int? cameraId) async => super
+      .noSuchMethod(Invocation.method(#resumePreview, <Object?>[cameraId]));
 
   @override
   Future<double> getMaxZoomLevel(int? cameraId) async => super.noSuchMethod(
-        Invocation.method(#getMaxZoomLevel, [cameraId]),
-        returnValue: 1.0,
-      );
+        Invocation.method(#getMaxZoomLevel, <Object?>[cameraId]),
+        returnValue: Future<double>.value(1.0),
+      ) as Future<double>;
 
   @override
   Future<double> getMinZoomLevel(int? cameraId) async => super.noSuchMethod(
-        Invocation.method(#getMinZoomLevel, [cameraId]),
-        returnValue: 0.0,
-      );
+        Invocation.method(#getMinZoomLevel, <Object?>[cameraId]),
+        returnValue: Future<double>.value(0.0),
+      ) as Future<double>;
 
   @override
   Future<void> setZoomLevel(int? cameraId, double? zoom) async =>
-      super.noSuchMethod(Invocation.method(#setZoomLevel, [cameraId, zoom]));
+      super.noSuchMethod(
+          Invocation.method(#setZoomLevel, <Object?>[cameraId, zoom]));
 
   @override
   Future<void> setFlashMode(int? cameraId, FlashMode? mode) async =>
-      super.noSuchMethod(Invocation.method(#setFlashMode, [cameraId, mode]));
+      super.noSuchMethod(
+          Invocation.method(#setFlashMode, <Object?>[cameraId, mode]));
 
   @override
   Future<void> setExposureMode(int? cameraId, ExposureMode? mode) async =>
-      super.noSuchMethod(Invocation.method(#setExposureMode, [cameraId, mode]));
+      super.noSuchMethod(
+          Invocation.method(#setExposureMode, <Object?>[cameraId, mode]));
 
   @override
   Future<void> setExposurePoint(int? cameraId, Point<double>? point) async =>
       super.noSuchMethod(
-          Invocation.method(#setExposurePoint, [cameraId, point]));
+          Invocation.method(#setExposurePoint, <Object?>[cameraId, point]));
 
   @override
   Future<double> getMinExposureOffset(int? cameraId) async =>
       super.noSuchMethod(
-        Invocation.method(#getMinExposureOffset, [cameraId]),
-        returnValue: 0.0,
-      );
+        Invocation.method(#getMinExposureOffset, <Object?>[cameraId]),
+        returnValue: Future<double>.value(0.0),
+      ) as Future<double>;
 
   @override
   Future<double> getMaxExposureOffset(int? cameraId) async =>
       super.noSuchMethod(
-        Invocation.method(#getMaxExposureOffset, [cameraId]),
-        returnValue: 1.0,
-      );
+        Invocation.method(#getMaxExposureOffset, <Object?>[cameraId]),
+        returnValue: Future<double>.value(1.0),
+      ) as Future<double>;
 
   @override
   Future<double> getExposureOffsetStepSize(int? cameraId) async =>
       super.noSuchMethod(
-        Invocation.method(#getExposureOffsetStepSize, [cameraId]),
-        returnValue: 1.0,
-      );
+        Invocation.method(#getExposureOffsetStepSize, <Object?>[cameraId]),
+        returnValue: Future<double>.value(1.0),
+      ) as Future<double>;
 
   @override
   Future<double> setExposureOffset(int? cameraId, double? offset) async =>
       super.noSuchMethod(
-        Invocation.method(#setExposureOffset, [cameraId, offset]),
-        returnValue: 1.0,
-      );
+        Invocation.method(#setExposureOffset, <Object?>[cameraId, offset]),
+        returnValue: Future<double>.value(1.0),
+      ) as Future<double>;
 }
 
 class MockCameraDescription extends CameraDescription {
   /// Creates a new camera description with the given properties.
-  MockCameraDescription()
+  const MockCameraDescription()
       : super(
           name: 'Test',
           lensDirection: CameraLensDirection.back,
diff --git a/packages/camera/camera/test/camera_value_test.dart b/packages/camera/camera/test/camera_value_test.dart
index 4718d89..62df1fd 100644
--- a/packages/camera/camera/test/camera_value_test.dart
+++ b/packages/camera/camera/test/camera_value_test.dart
@@ -13,7 +13,7 @@
 void main() {
   group('camera_value', () {
     test('Can be created', () {
-      var cameraValue = const CameraValue(
+      const CameraValue cameraValue = CameraValue(
         isInitialized: false,
         errorDescription: null,
         previewSize: Size(10, 10),
@@ -36,7 +36,7 @@
       expect(cameraValue, isA<CameraValue>());
       expect(cameraValue.isInitialized, isFalse);
       expect(cameraValue.errorDescription, null);
-      expect(cameraValue.previewSize, Size(10, 10));
+      expect(cameraValue.previewSize, const Size(10, 10));
       expect(cameraValue.isRecordingPaused, isFalse);
       expect(cameraValue.isRecordingVideo, isFalse);
       expect(cameraValue.isTakingPicture, isFalse);
@@ -53,7 +53,7 @@
     });
 
     test('Can be created as uninitialized', () {
-      var cameraValue = const CameraValue.uninitialized();
+      const CameraValue cameraValue = CameraValue.uninitialized();
 
       expect(cameraValue, isA<CameraValue>());
       expect(cameraValue.isInitialized, isFalse);
@@ -75,8 +75,8 @@
     });
 
     test('Can be copied with isInitialized', () {
-      var cv = const CameraValue.uninitialized();
-      var cameraValue = cv.copyWith(isInitialized: true);
+      const CameraValue cv = CameraValue.uninitialized();
+      final CameraValue cameraValue = cv.copyWith(isInitialized: true);
 
       expect(cameraValue, isA<CameraValue>());
       expect(cameraValue.isInitialized, isTrue);
@@ -98,24 +98,24 @@
     });
 
     test('Has aspectRatio after setting size', () {
-      var cv = const CameraValue.uninitialized();
-      var cameraValue =
-          cv.copyWith(isInitialized: true, previewSize: Size(20, 10));
+      const CameraValue cv = CameraValue.uninitialized();
+      final CameraValue cameraValue =
+          cv.copyWith(isInitialized: true, previewSize: const Size(20, 10));
 
       expect(cameraValue.aspectRatio, 2.0);
     });
 
     test('hasError is true after setting errorDescription', () {
-      var cv = const CameraValue.uninitialized();
-      var cameraValue = cv.copyWith(errorDescription: 'error');
+      const CameraValue cv = CameraValue.uninitialized();
+      final CameraValue cameraValue = cv.copyWith(errorDescription: 'error');
 
       expect(cameraValue.hasError, isTrue);
       expect(cameraValue.errorDescription, 'error');
     });
 
     test('Recording paused is false when not recording', () {
-      var cv = const CameraValue.uninitialized();
-      var cameraValue = cv.copyWith(
+      const CameraValue cv = CameraValue.uninitialized();
+      final CameraValue cameraValue = cv.copyWith(
           isInitialized: true,
           isRecordingVideo: false,
           isRecordingPaused: true);
@@ -124,7 +124,7 @@
     });
 
     test('toString() works as expected', () {
-      var cameraValue = const CameraValue(
+      const CameraValue cameraValue = CameraValue(
           isInitialized: false,
           errorDescription: null,
           previewSize: Size(10, 10),
diff --git a/packages/camera/camera/test/utils/method_channel_mock.dart b/packages/camera/camera/test/utils/method_channel_mock.dart
index 60d8def..7c8b4ca 100644
--- a/packages/camera/camera/test/utils/method_channel_mock.dart
+++ b/packages/camera/camera/test/utils/method_channel_mock.dart
@@ -6,11 +6,6 @@
 import 'package:flutter_test/flutter_test.dart';
 
 class MethodChannelMock {
-  final Duration? delay;
-  final MethodChannel methodChannel;
-  final Map<String, dynamic> methods;
-  final log = <MethodCall>[];
-
   MethodChannelMock({
     required String channelName,
     this.delay,
@@ -19,7 +14,12 @@
     methodChannel.setMockMethodCallHandler(_handler);
   }
 
-  Future _handler(MethodCall methodCall) async {
+  final Duration? delay;
+  final MethodChannel methodChannel;
+  final Map<String, dynamic> methods;
+  final List<MethodCall> log = <MethodCall>[];
+
+  Future<dynamic> _handler(MethodCall methodCall) async {
     log.add(methodCall);
 
     if (!methods.containsKey(methodCall.method)) {
@@ -27,13 +27,13 @@
           '${methodCall.method} on channel ${methodChannel.name}');
     }
 
-    return Future.delayed(delay ?? Duration.zero, () {
-      final result = methods[methodCall.method];
+    return Future<dynamic>.delayed(delay ?? Duration.zero, () {
+      final Object? result = methods[methodCall.method];
       if (result is Exception) {
         throw result;
       }
 
-      return Future.value(result);
+      return Future<dynamic>.value(result);
     });
   }
 }
diff --git a/script/configs/custom_analysis.yaml b/script/configs/custom_analysis.yaml
index 493b6e6..7e4d383 100644
--- a/script/configs/custom_analysis.yaml
+++ b/script/configs/custom_analysis.yaml
@@ -11,7 +11,6 @@
 
 # TODO(ecosystem): Remove everything from this list. See:
 # https://github.com/flutter/flutter/issues/76229
-- camera/camera
 - camera/camera_web
 - google_maps_flutter/google_maps_flutter
 - google_maps_flutter/google_maps_flutter_platform_interface