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

Supress strong_mode_implicit_dynamic_method for invokeMethod calls. #1065

Merged
merged 1 commit into from
Jan 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/android_alarm_manager/lib/android_alarm_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ void _alarmManagerCallbackDispatcher() {

// Once we've finished initializing, let the native portion of the plugin
// know that it can start scheduling alarms.
// 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
_channel.invokeMethod('AlarmService.initialized');
}

Expand All @@ -67,6 +70,9 @@ class AndroidAlarmManager {
return false;
}
final dynamic r = await _channel
// 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('AlarmService.start', <dynamic>[handle.toRawHandle()]);
return r ?? false;
}
Expand Down Expand Up @@ -106,6 +112,9 @@ class AndroidAlarmManager {
if (handle == null) {
return 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
final dynamic r = await _channel.invokeMethod('Alarm.oneShot', <dynamic>[
id,
exact,
Expand Down Expand Up @@ -152,6 +161,9 @@ class AndroidAlarmManager {
if (handle == null) {
return 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
final dynamic r = await _channel.invokeMethod('Alarm.periodic',
<dynamic>[id, exact, wakeup, first, period, handle.toRawHandle()]);
return (r == null) ? false : r;
Expand All @@ -166,6 +178,9 @@ class AndroidAlarmManager {
/// failure.
static Future<bool> cancel(int id) async {
final dynamic r =
// 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('Alarm.cancel', <dynamic>[id]);
return (r == null) ? false : r;
}
Expand Down
3 changes: 3 additions & 0 deletions packages/android_intent/lib/android_intent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class AndroidIntent {
if (package != null) {
args['package'] = package;
}
// 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('launch', args);
}
}
3 changes: 3 additions & 0 deletions packages/battery/lib/battery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class Battery {

/// Returns the current battery level in percent.
Future<int> get batteryLevel => _methodChannel
// 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('getBatteryLevel')
.then<int>((dynamic result) => result);

Expand Down
3 changes: 3 additions & 0 deletions packages/battery/test/battery_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ void main() {
});

test('batteryLevel', () async {
// 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
when(methodChannel.invokeMethod('getBatteryLevel'))
.thenAnswer((Invocation invoke) => Future<int>.value(42));
expect(await battery.batteryLevel, 42);
Expand Down
27 changes: 27 additions & 0 deletions packages/camera/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
18 changes: 18 additions & 0 deletions packages/cloud_firestore/lib/src/document_reference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class DocumentReference {
/// If [merge] is true, the provided data will be merged into an
/// existing document instead of overwriting.
Future<void> setData(Map<String, dynamic> data, {bool merge = 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
return Firestore.channel.invokeMethod(
'DocumentReference#setData',
<String, dynamic>{
Expand All @@ -58,6 +61,9 @@ class DocumentReference {
///
/// If no document exists yet, the update will fail.
Future<void> updateData(Map<String, dynamic> data) {
// 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
return Firestore.channel.invokeMethod(
'DocumentReference#updateData',
<String, dynamic>{
Expand All @@ -72,6 +78,9 @@ class DocumentReference {
///
/// If no document exists, the read will return null.
Future<DocumentSnapshot> get() async {
// 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> data = await Firestore.channel.invokeMethod(
'DocumentReference#get',
<String, dynamic>{'app': firestore.app.name, 'path': path},
Expand All @@ -85,6 +94,9 @@ class DocumentReference {

/// Deletes the document referred to by this [DocumentReference].
Future<void> delete() {
// 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
return Firestore.channel.invokeMethod(
'DocumentReference#delete',
<String, dynamic>{'app': firestore.app.name, 'path': path},
Expand All @@ -108,6 +120,9 @@ class DocumentReference {
StreamController<DocumentSnapshot> controller; // ignore: close_sinks
controller = StreamController<DocumentSnapshot>.broadcast(
onListen: () {
// 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
_handle = Firestore.channel.invokeMethod(
'Query#addDocumentListener',
<String, dynamic>{
Expand All @@ -121,6 +136,9 @@ class DocumentReference {
},
onCancel: () {
_handle.then((int handle) async {
// 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 Firestore.channel.invokeMethod(
'Query#removeListener',
<String, dynamic>{'handle': handle},
Expand Down
9 changes: 9 additions & 0 deletions packages/cloud_firestore/lib/src/firestore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ class Firestore {
final int transactionId = _transactionHandlerId++;
_transactionHandlers[transactionId] = transactionHandler;
final Map<dynamic, dynamic> result = await channel
// 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('Firestore#runTransaction', <String, dynamic>{
'app': app.name,
'transactionId': transactionId,
Expand All @@ -122,6 +125,9 @@ class Firestore {
@deprecated
Future<void> enablePersistence(bool enable) async {
assert(enable != null);
// 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('Firestore#enablePersistence', <String, dynamic>{
'app': app.name,
'enable': enable,
Expand All @@ -133,6 +139,9 @@ class Firestore {
String host,
bool sslEnabled,
bool timestampsInSnapshotsEnabled}) async {
// 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('Firestore#settings', <String, dynamic>{
'app': app.name,
'persistenceEnabled': persistenceEnabled,
Expand Down
9 changes: 9 additions & 0 deletions packages/cloud_firestore/lib/src/query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class Query {
StreamController<QuerySnapshot> controller; // ignore: close_sinks
controller = StreamController<QuerySnapshot>.broadcast(
onListen: () {
// 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
_handle = Firestore.channel.invokeMethod(
'Query#addSnapshotListener',
<String, dynamic>{
Expand All @@ -67,6 +70,9 @@ class Query {
},
onCancel: () {
_handle.then((int handle) async {
// 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 Firestore.channel.invokeMethod(
'Query#removeListener',
<String, dynamic>{'handle': handle},
Expand All @@ -80,6 +86,9 @@ class Query {

/// Fetch the documents for this query
Future<QuerySnapshot> getDocuments() async {
// 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> data = await Firestore.channel.invokeMethod(
'Query#getDocuments',
<String, dynamic>{
Expand Down
12 changes: 12 additions & 0 deletions packages/cloud_firestore/lib/src/transaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class Transaction {

Future<DocumentSnapshot> get(DocumentReference documentReference) async {
final dynamic result = await Firestore.channel
// 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('Transaction#get', <String, dynamic>{
'app': _firestore.app.name,
'transactionId': _transactionId,
Expand All @@ -30,6 +33,9 @@ class Transaction {

Future<void> delete(DocumentReference documentReference) async {
return Firestore.channel
// 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('Transaction#delete', <String, dynamic>{
'app': _firestore.app.name,
'transactionId': _transactionId,
Expand All @@ -40,6 +46,9 @@ class Transaction {
Future<void> update(
DocumentReference documentReference, Map<String, dynamic> data) async {
return Firestore.channel
// 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('Transaction#update', <String, dynamic>{
'app': _firestore.app.name,
'transactionId': _transactionId,
Expand All @@ -50,6 +59,9 @@ class Transaction {

Future<void> set(
DocumentReference documentReference, Map<String, dynamic> data) async {
// 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
return Firestore.channel.invokeMethod('Transaction#set', <String, dynamic>{
'app': _firestore.app.name,
'transactionId': _transactionId,
Expand Down
15 changes: 15 additions & 0 deletions packages/cloud_firestore/lib/src/write_batch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ part of cloud_firestore;
/// nor can it be committed again.
class WriteBatch {
WriteBatch._(this._firestore)
// 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
: _handle = Firestore.channel.invokeMethod(
'WriteBatch#create', <String, dynamic>{'app': _firestore.app.name});

Expand All @@ -29,6 +32,9 @@ class WriteBatch {
if (!_committed) {
_committed = true;
await Future.wait<dynamic>(_actions);
// 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 Firestore.channel.invokeMethod(
'WriteBatch#commit', <String, dynamic>{'handle': await _handle});
} else {
Expand All @@ -41,6 +47,9 @@ class WriteBatch {
if (!_committed) {
_handle.then((dynamic handle) {
_actions.add(
// 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
Firestore.channel.invokeMethod(
'WriteBatch#delete',
<String, dynamic>{
Expand Down Expand Up @@ -68,6 +77,9 @@ class WriteBatch {
if (!_committed) {
_handle.then((dynamic handle) {
_actions.add(
// 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
Firestore.channel.invokeMethod(
'WriteBatch#setData',
<String, dynamic>{
Expand All @@ -93,6 +105,9 @@ class WriteBatch {
if (!_committed) {
_handle.then((dynamic handle) {
_actions.add(
// 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
Firestore.channel.invokeMethod(
'WriteBatch#updateData',
<String, dynamic>{
Expand Down
3 changes: 3 additions & 0 deletions packages/cloud_functions/lib/cloud_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class CloudFunctions {
{@required String functionName, Map<String, dynamic> parameters}) async {
try {
final dynamic response =
// 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('CloudFunctions#call', <String, dynamic>{
'functionName': functionName,
'parameters': parameters,
Expand Down
Loading