@@ -50,24 +50,37 @@ void setupMockPrinting() {
50
50
}
51
51
52
52
void setupMockAudioplayers () {
53
- TestWidgetsFlutterBinding .ensureInitialized ();
53
+ final binding = TestWidgetsFlutterBinding .ensureInitialized ();
54
54
55
- const channel = MethodChannel ('xyz.luan/audioplayers' );
56
- TestDefaultBinaryMessengerBinding .instance.defaultBinaryMessenger
57
- .setMockMethodCallHandler (channel, (MethodCall methodCall) async {
58
- if (methodCall.method == 'create' ) {
59
- return true ;
60
- }
61
- return null ;
62
- });
55
+ binding.defaultBinaryMessenger.setMockMethodCallHandler (
56
+ MethodChannel ('xyz.luan/audioplayers' ),
57
+ (MethodCall methodCall) async {
58
+ if (methodCall.method == 'create' ) return true ;
59
+ return null ;
60
+ },
61
+ );
63
62
64
- const playerChannel =
65
- MethodChannel ('xyz.luan/audioplayers/events/pencilSoundEffect' );
66
- TestDefaultBinaryMessengerBinding .instance.defaultBinaryMessenger
67
- .setMockMethodCallHandler (playerChannel, (MethodCall methodCall) async {
68
- if (methodCall.method == 'listen' ) {
69
- return true ;
70
- }
71
- return null ;
72
- });
63
+ binding.defaultBinaryMessenger.setMockMethodCallHandler (
64
+ MethodChannel ('xyz.luan/audioplayers.global' ),
65
+ (MethodCall methodCall) async {
66
+ if (methodCall.method == 'init' ) return true ;
67
+ return null ;
68
+ },
69
+ );
70
+
71
+ binding.defaultBinaryMessenger.setMockMethodCallHandler (
72
+ MethodChannel ('xyz.luan/audioplayers.global/events' ),
73
+ (MethodCall methodCall) async {
74
+ if (methodCall.method == 'listen' ) return true ;
75
+ return null ;
76
+ },
77
+ );
78
+
79
+ binding.defaultBinaryMessenger.setMockMethodCallHandler (
80
+ MethodChannel ('xyz.luan/audioplayers/events/pencilSoundEffect' ),
81
+ (MethodCall methodCall) async {
82
+ if (methodCall.method == 'listen' ) return true ;
83
+ return null ;
84
+ },
85
+ );
73
86
}
0 commit comments