Skip to content

Commit

Permalink
chore(flutter): fix all flutter analyzer issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehardy committed Dec 13, 2023
1 parent 18ee7ed commit 59fce1a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
12 changes: 7 additions & 5 deletions packages/flutter/packages/notifee/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,17 @@ class _Application extends State<Application> {

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();
}

Expand Down Expand Up @@ -238,9 +240,9 @@ class _Application extends State<Application> {
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()),
Expand Down
7 changes: 0 additions & 7 deletions packages/flutter/packages/notifee/test/notifee_test.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
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';
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();
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
Expand Down

0 comments on commit 59fce1a

Please sign in to comment.