diff --git a/packages/flutter/packages/notifee/example/lib/main.dart b/packages/flutter/packages/notifee/example/lib/main.dart index 7c72c2264..be444c115 100644 --- a/packages/flutter/packages/notifee/example/lib/main.dart +++ b/packages/flutter/packages/notifee/example/lib/main.dart @@ -112,15 +112,17 @@ class _Application extends State { notifee.onForegroundEvent.listen((Event event) { if (kDebugMode) { - print('A new event was published1!'); - print('in here'); + print('A new event was published!'); + print('in onForegroundEvent listener'); } if (event.detail.notification == null) { return; } if (event.type == EventType.press) { - print('in here'); + if (kDebugMode) { + print('in EventType.press handler'); + } displayNotification(); } @@ -238,9 +240,9 @@ class _Application extends State { child: const Icon(Icons.send), ), ), - body: SingleChildScrollView( + body: const SingleChildScrollView( child: Column( - children: const [ + children: [ MetaCard(title: 'Permissions', children: Permissions()), MetaCard( title: 'Notification Stream', children: NotificationList()), diff --git a/packages/flutter/packages/notifee/test/notifee_test.dart b/packages/flutter/packages/notifee/test/notifee_test.dart index a4b20bc4e..a9fcdded9 100644 --- a/packages/flutter/packages/notifee/test/notifee_test.dart +++ b/packages/flutter/packages/notifee/test/notifee_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; @@ -6,8 +5,6 @@ import 'package:notifee_platform_interface/notifee_platform_interface.dart'; import 'package:notifee/notifee.dart' as notifee; void main() { - const MethodChannel channel = MethodChannel('notifee'); - TestWidgetsFlutterBinding.ensureInitialized(); final MockNotifee kMockNotifeePlatform = MockNotifee(); @@ -16,10 +13,6 @@ void main() { NotifeePlatform.instance = kMockNotifeePlatform; }); - tearDown(() { - channel.setMockMethodCallHandler(null); - }); - group('cancelAllNotifications', () { test('verify delegate method is called with correct args', () async { when(kMockNotifeePlatform.cancelAllNotifications( diff --git a/packages/flutter/packages/notifee_platform_interface/test/method_channel_test/method_channel_notifee_test.dart b/packages/flutter/packages/notifee_platform_interface/test/method_channel_test/method_channel_notifee_test.dart index 50e72e5f9..d32cb2758 100644 --- a/packages/flutter/packages/notifee_platform_interface/test/method_channel_test/method_channel_notifee_test.dart +++ b/packages/flutter/packages/notifee_platform_interface/test/method_channel_test/method_channel_notifee_test.dart @@ -6,14 +6,15 @@ import 'package:flutter_test/flutter_test.dart'; typedef MethodCallCallback = dynamic Function(MethodCall methodCall); void handleMethodCall(MethodCallCallback methodCallCallback) => - MethodChannelNotifee.channel.setMockMethodCallHandler((call) async { + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(MethodChannelNotifee.channel, (call) async { return await methodCallCallback(call); }); void initializeMethodChannel() { TestWidgetsFlutterBinding.ensureInitialized(); - - MethodChannelNotifee.channel.setMockMethodCallHandler((call) async { + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(MethodChannelNotifee.channel, (call) async { return null; }); }