Unverified Commit 5a862ebe authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Replace dynamic with Object? in SystemChannels (#94629)

parent ec40357f
......@@ -284,7 +284,7 @@ abstract class RawKeyEvent with Diagnosticable {
/// Creates a concrete [RawKeyEvent] class from a message in the form received
/// on the [SystemChannels.keyEvent] channel.
factory RawKeyEvent.fromMessage(Map<String, dynamic> message) {
factory RawKeyEvent.fromMessage(Map<String, Object?> message) {
String? character;
RawKeyEventData _dataFromWeb() {
final String? key = message['key'] as String?;
......@@ -303,7 +303,7 @@ abstract class RawKeyEvent with Diagnosticable {
if (kIsWeb) {
data = _dataFromWeb();
} else {
final String keymap = message['keymap'] as String;
final String keymap = message['keymap']! as String;
switch (keymap) {
case 'android':
data = RawKeyEventDataAndroid(
......@@ -388,7 +388,7 @@ abstract class RawKeyEvent with Diagnosticable {
throw FlutterError('Unknown keymap for key events: $keymap');
}
}
final String type = message['type'] as String;
final String type = message['type']! as String;
switch (type) {
case 'keydown':
return RawKeyDownEvent(data: data, character: character);
......
......@@ -240,7 +240,7 @@ class SystemChannels {
/// * [RawKeyboard], which uses this channel to expose key data.
/// * [new RawKeyEvent.fromMessage], which can decode this data into the [RawKeyEvent]
/// subclasses mentioned above.
static const BasicMessageChannel<dynamic> keyEvent = BasicMessageChannel<dynamic>(
static const BasicMessageChannel<Object?> keyEvent = BasicMessageChannel<Object?>(
'flutter/keyevent',
JSONMessageCodec(),
);
......@@ -271,7 +271,7 @@ class SystemChannels {
/// applications to release caches to free up more memory. See
/// [WidgetsBindingObserver.didHaveMemoryPressure], which triggers whenever
/// a message is received on this channel.
static const BasicMessageChannel<dynamic> system = BasicMessageChannel<dynamic>(
static const BasicMessageChannel<Object?> system = BasicMessageChannel<Object?>(
'flutter/system',
JSONMessageCodec(),
);
......@@ -283,7 +283,7 @@ class SystemChannels {
/// * [SemanticsEvent] and its subclasses for a list of valid accessibility
/// events that can be sent over this channel.
/// * [SemanticsNode.sendEvent], which uses this channel to dispatch events.
static const BasicMessageChannel<dynamic> accessibility = BasicMessageChannel<dynamic>(
static const BasicMessageChannel<Object?> accessibility = BasicMessageChannel<Object?>(
'flutter/accessibility',
StandardMessageCodec(),
);
......@@ -311,7 +311,7 @@ class SystemChannels {
/// A [MethodChannel] for configuring mouse cursors.
///
/// All outgoing methods defined for this channel uses a `Map<String, dynamic>`
/// All outgoing methods defined for this channel uses a `Map<String, Object?>`
/// to contain multiple parameters, including the following methods (invoked
/// using [OptionalMethodChannel.invokeMethod]):
///
......
......@@ -688,8 +688,8 @@ class KeyEventSimulator {
result.complete(false);
return;
}
final Map<String, dynamic> decoded = SystemChannels.keyEvent.codec.decodeMessage(data) as Map<String, dynamic>;
result.complete(decoded['handled'] as bool);
final Map<String, Object?> decoded = SystemChannels.keyEvent.codec.decodeMessage(data)! as Map<String, dynamic>;
result.complete(decoded['handled']! as bool);
}
);
return result.future;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment