Skip to content

Commit 5c277d3

Browse files
authored
fixed deprecation warnings on calling setMockMethodCallHandler() (#2039)
1 parent 6c3ecd7 commit 5c277d3

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

flutter_local_notifications/test/android_flutter_local_notifications_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ void main() {
2525
setUp(() {
2626
debugDefaultTargetPlatformOverride = TargetPlatform.android;
2727
flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
28-
// ignore: always_specify_types
29-
channel.setMockMethodCallHandler((methodCall) async {
28+
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
29+
.setMockMethodCallHandler(channel, (MethodCall methodCall) async {
3030
log.add(methodCall);
3131
if (methodCall.method == 'initialize') {
3232
return true;
@@ -37,6 +37,7 @@ void main() {
3737
} else if (methodCall.method == 'getNotificationAppLaunchDetails') {
3838
return null;
3939
}
40+
return null;
4041
});
4142
});
4243

flutter_local_notifications/test/ios_flutter_local_notifications_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ void main() {
2020
setUp(() {
2121
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
2222
flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
23-
// ignore: always_specify_types
24-
channel.setMockMethodCallHandler((methodCall) async {
23+
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
24+
.setMockMethodCallHandler(channel, (MethodCall methodCall) async {
2525
log.add(methodCall);
2626
if (methodCall.method == 'pendingNotificationRequests') {
2727
return <Map<String, Object>?>[];
@@ -30,6 +30,7 @@ void main() {
3030
} else if (methodCall.method == 'getNotificationAppLaunchDetails') {
3131
return null;
3232
}
33+
return null;
3334
});
3435
});
3536

flutter_local_notifications/test/macos_flutter_local_notifications_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ void main() {
1919
setUp(() {
2020
debugDefaultTargetPlatformOverride = TargetPlatform.macOS;
2121
flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
22-
// ignore: always_specify_types
23-
channel.setMockMethodCallHandler((methodCall) async {
22+
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
23+
.setMockMethodCallHandler(channel, (MethodCall methodCall) async {
2424
log.add(methodCall);
2525
if (methodCall.method == 'pendingNotificationRequests') {
2626
return <Map<String, Object>?>[];
@@ -29,6 +29,7 @@ void main() {
2929
} else if (methodCall.method == 'getNotificationAppLaunchDetails') {
3030
return null;
3131
}
32+
return null;
3233
});
3334
});
3435

0 commit comments

Comments
 (0)