Skip to content

Commit

Permalink
Supress strong_mode_implicit_dynamic_method for invokeMethod call…
Browse files Browse the repository at this point in the history
…s. (flutter#1065)

flutter/flutter#26303 added a template argument to `invokeMethod`, which triggers the `strong_mode_implicit_dynamic_method` analyzer warning in many call sites in the plugins repo.

We should add the type parameter to all these call sites, but we can only do that after bumping the Flutter dependency constraint which we will only do once the `invokeMethod` change makes it to the stable release.

For now we're suppressing the warning in all call sites (we're not disabling the lint wholesale as we still want it for the rest of the code)

See: flutter/flutter#26431
  • Loading branch information
amirh authored Jan 12, 2019
1 parent 1e678d9 commit b508d72
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import 'package:flutter/widgets.dart';
part 'camera_image.dart';

final MethodChannel _channel = const MethodChannel('plugins.flutter.io/camera')
// TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
// https://github.com/flutter/flutter/issues/26431
// ignore: strong_mode_implicit_dynamic_method
..invokeMethod('init');

enum CameraLensDirection { front, back, external }
Expand Down Expand Up @@ -50,6 +53,9 @@ CameraLensDirection _parseCameraLensDirection(String string) {
Future<List<CameraDescription>> availableCameras() async {
try {
final List<dynamic> cameras =
// TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
// https://github.com/flutter/flutter/issues/26431
// ignore: strong_mode_implicit_dynamic_method
await _channel.invokeMethod('availableCameras');
return cameras.map((dynamic camera) {
return CameraDescription(
Expand Down Expand Up @@ -214,6 +220,9 @@ class CameraController extends ValueNotifier<CameraValue> {
}
try {
_creatingCompleter = Completer<void>();
// TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
// https://github.com/flutter/flutter/issues/26431
// ignore: strong_mode_implicit_dynamic_method
final Map<dynamic, dynamic> reply = await _channel.invokeMethod(
'initialize',
<String, dynamic>{
Expand Down Expand Up @@ -283,6 +292,9 @@ class CameraController extends ValueNotifier<CameraValue> {
}
try {
value = value.copyWith(isTakingPicture: true);
// TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
// https://github.com/flutter/flutter/issues/26431
// ignore: strong_mode_implicit_dynamic_method
await _channel.invokeMethod(
'takePicture',
<String, dynamic>{'textureId': _textureId, 'path': path},
Expand Down Expand Up @@ -328,6 +340,9 @@ class CameraController extends ValueNotifier<CameraValue> {
}

try {
// TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
// https://github.com/flutter/flutter/issues/26431
// ignore: strong_mode_implicit_dynamic_method
await _channel.invokeMethod('startImageStream');
value = value.copyWith(isStreamingImages: true);
} on PlatformException catch (e) {
Expand Down Expand Up @@ -369,6 +384,9 @@ class CameraController extends ValueNotifier<CameraValue> {

try {
value = value.copyWith(isStreamingImages: false);
// TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
// https://github.com/flutter/flutter/issues/26431
// ignore: strong_mode_implicit_dynamic_method
await _channel.invokeMethod('stopImageStream');
} on PlatformException catch (e) {
throw CameraException(e.code, e.message);
Expand Down Expand Up @@ -409,6 +427,9 @@ class CameraController extends ValueNotifier<CameraValue> {
}

try {
// TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
// https://github.com/flutter/flutter/issues/26431
// ignore: strong_mode_implicit_dynamic_method
await _channel.invokeMethod(
'startVideoRecording',
<String, dynamic>{'textureId': _textureId, 'filePath': filePath},
Expand All @@ -435,6 +456,9 @@ class CameraController extends ValueNotifier<CameraValue> {
}
try {
value = value.copyWith(isRecordingVideo: false);
// TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
// https://github.com/flutter/flutter/issues/26431
// ignore: strong_mode_implicit_dynamic_method
await _channel.invokeMethod(
'stopVideoRecording',
<String, dynamic>{'textureId': _textureId},
Expand All @@ -454,6 +478,9 @@ class CameraController extends ValueNotifier<CameraValue> {
super.dispose();
if (_creatingCompleter != null) {
await _creatingCompleter.future;
// TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
// https://github.com/flutter/flutter/issues/26431
// ignore: strong_mode_implicit_dynamic_method
await _channel.invokeMethod(
'dispose',
<String, dynamic>{'textureId': _textureId},
Expand Down

0 comments on commit b508d72

Please sign in to comment.