createSyntheticKeyboardEvent function
SyntheticKeyboardEvent
createSyntheticKeyboardEvent({
- SyntheticKeyboardEvent? baseEvent,
- bool? bubbles,
- bool? cancelable,
- Object? currentTarget,
- bool? defaultPrevented,
- void preventDefault()?,
- void stopPropagation()?,
- num? eventPhase,
- bool? isTrusted,
- Object? nativeEvent,
- Object? target,
- num? timeStamp,
- String? type,
- bool? altKey,
- String? char,
- bool? ctrlKey,
- String? locale,
- num? location,
- String? key,
- bool? metaKey,
- bool? repeat,
- bool? shiftKey,
- num? keyCode,
- num? charCode,
Returns a newly constructed SyntheticKeyboardEvent instance.
In addition to creating empty instances (by invoking without any parameters) or completely custom instances
by using the named parameters, this function will merge previously existing baseEvent
s with the named parameters provided.
The named parameters takes precedence, and therefore can be used to override specific fields on the baseEvent
.
Implementation
SyntheticKeyboardEvent createSyntheticKeyboardEvent({
SyntheticKeyboardEvent? baseEvent,
bool? bubbles,
bool? cancelable,
Object? currentTarget,
bool? defaultPrevented,
void Function()? preventDefault,
void Function()? stopPropagation,
num? eventPhase,
bool? isTrusted,
Object? nativeEvent,
Object? target,
num? timeStamp,
String? type,
bool? altKey,
String? char,
bool? ctrlKey,
String? locale,
num? location,
String? key,
bool? metaKey,
bool? repeat,
bool? shiftKey,
num? keyCode,
num? charCode,
}) {
return jsifyAndAllowInterop({
..._wrapBaseEventPropertiesInMap(
baseEvent: baseEvent,
bubbles: bubbles,
cancelable: cancelable,
currentTarget: currentTarget,
defaultPrevented: defaultPrevented,
preventDefault: preventDefault,
stopPropagation: stopPropagation,
eventPhase: eventPhase,
isTrusted: isTrusted,
nativeEvent: nativeEvent,
target: target,
timeStamp: timeStamp,
type: type,
),
'altKey': altKey ?? baseEvent?.altKey ?? false,
'char': char ?? baseEvent?.char,
'charCode': charCode ?? baseEvent?.charCode,
'ctrlKey': ctrlKey ?? baseEvent?.ctrlKey ?? false,
'locale': locale ?? baseEvent?.locale,
'location': location ?? baseEvent?.location,
'key': key ?? baseEvent?.key,
'keyCode': keyCode ?? baseEvent?.keyCode,
'metaKey': metaKey ?? baseEvent?.metaKey ?? false,
'repeat': repeat ?? baseEvent?.repeat,
'shiftKey': shiftKey ?? baseEvent?.shiftKey ?? false,
}) as SyntheticKeyboardEvent;
}