Skip to content

Commit d012855

Browse files
Fix key event platform override behavior (Resolves #14) (#15)
1 parent 09d0ac2 commit d012855

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/src/keyboard.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ extension KeyboardInput on WidgetTester {
515515
}
516516

517517
String get _keyEventPlatform {
518+
if (keyEventPlatformOverride != null) {
519+
return keyEventPlatformOverride!;
520+
}
521+
518522
switch (defaultTargetPlatform) {
519523
case TargetPlatform.android:
520524
return "android";
@@ -534,6 +538,9 @@ String get _keyEventPlatform {
534538
///
535539
/// When `null`, Flutter's `defaultTargetPlatform` determines the `platform` value
536540
/// that's passed to every key simulation event.
541+
///
542+
/// It is your responsibility to nullify this value when you're done with your
543+
/// platform overrides.
537544
String? keyEventPlatformOverride;
538545

539546
/// Returns a physical keyboard key combination that expects to create the

0 commit comments

Comments
 (0)