Skip to content

Commit 415d09c

Browse files
bparrishMinesnploi
authored andcommitted
[in_app_purchase_android] Fix mockMethodCallHandler lint (flutter#3674)
1 parent 5cbf3cf commit 415d09c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ void main() {
2626
const String onBillingServiceDisconnectedCallback =
2727
'BillingClientStateListener#onBillingServiceDisconnected()';
2828

29-
setUpAll(() =>
30-
channel.setMockMethodCallHandler(stubPlatform.fakeMethodCallHandler));
29+
setUpAll(() => _ambiguate(TestDefaultBinaryMessengerBinding.instance)!
30+
.defaultBinaryMessenger
31+
.setMockMethodCallHandler(channel, stubPlatform.fakeMethodCallHandler));
3132

3233
setUp(() {
3334
WidgetsFlutterBinding.ensureInitialized();
@@ -105,3 +106,9 @@ void main() {
105106
});
106107
});
107108
}
109+
110+
/// This allows a value of type T or T? to be treated as a value of type T?.
111+
///
112+
/// We use this so that APIs that have become non-nullable can still be used
113+
/// with `!` and `?` on the stable branch.
114+
T? _ambiguate<T>(T? value) => value;

0 commit comments

Comments
 (0)