Skip to content

Commit

Permalink
Fix key event platform override behavior (Resolves #14) (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-carroll committed Sep 3, 2023
1 parent 09d0ac2 commit d012855
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/src/keyboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,10 @@ extension KeyboardInput on WidgetTester {
}

String get _keyEventPlatform {
if (keyEventPlatformOverride != null) {
return keyEventPlatformOverride!;
}

switch (defaultTargetPlatform) {
case TargetPlatform.android:
return "android";
Expand All @@ -534,6 +538,9 @@ String get _keyEventPlatform {
///
/// When `null`, Flutter's `defaultTargetPlatform` determines the `platform` value
/// that's passed to every key simulation event.
///
/// It is your responsibility to nullify this value when you're done with your
/// platform overrides.
String? keyEventPlatformOverride;

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

0 comments on commit d012855

Please sign in to comment.