diff --git a/dev/tools/gen_keycodes/data/keyboard_key.tmpl b/dev/tools/gen_keycodes/data/keyboard_key.tmpl index 740ea90e8e..c23a284a83 100644 --- a/dev/tools/gen_keycodes/data/keyboard_key.tmpl +++ b/dev/tools/gen_keycodes/data/keyboard_key.tmpl @@ -45,7 +45,7 @@ abstract class KeyboardKey extends Diagnosticable { /// look at the physical key to make sure that regardless of the character the /// key produces, you got the key that is in that location on the keyboard. /// -/// {@tool snippet --template=stateful_widget_scaffold} +/// {@tool sample --template=stateful_widget_scaffold} /// This example shows how to detect if the user has selected the logical "Q" /// key. /// @@ -127,7 +127,7 @@ class LogicalKeyboardKey extends KeyboardKey { /// /// [keyId] must not be null. /// - /// {@tool sample} + /// {@tool snippet} /// To save executable size, it is recommended that the [debugName] be null in /// release mode. You can do this by using the [kReleaseMode] constant. /// @@ -167,12 +167,12 @@ class LogicalKeyboardKey extends KeyboardKey { int get hashCode => keyId.hashCode; @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { if (other.runtimeType != runtimeType) { return false; } - final LogicalKeyboardKey typedOther = other; - return keyId == typedOther.keyId; + return other is LogicalKeyboardKey + && other.keyId == keyId; } /// Returns the [LogicalKeyboardKey] constant that matches the given ID, or @@ -246,7 +246,7 @@ class LogicalKeyboardKey extends KeyboardKey { /// [control], so that the question "is any control key down?" can be asked. static Set collapseSynonyms(Set input) { final Set result = {}; - for (LogicalKeyboardKey key in input) { + for (final LogicalKeyboardKey key in input) { final LogicalKeyboardKey synonym = _synonyms[key]; result.add(synonym ?? key); } @@ -331,7 +331,7 @@ class LogicalKeyboardKey extends KeyboardKey { /// looking for "the key next next to the TAB key", since on a French keyboard, /// the key next to the TAB key has an "A" on it. /// -/// {@tool snippet --template=stateful_widget_scaffold} +/// {@tool sample --template=stateful_widget_scaffold} /// This example shows how to detect if the user has selected the physical key /// to the right of the CAPS LOCK key. /// @@ -407,7 +407,7 @@ class PhysicalKeyboardKey extends KeyboardKey { /// /// The [usbHidUsage] must not be null. /// - /// {@tool sample} + /// {@tool snippet} /// To save executable size, it is recommended that the [debugName] be null in /// release mode. You can do this using the [kReleaseMode] constant. /// @@ -440,12 +440,12 @@ class PhysicalKeyboardKey extends KeyboardKey { int get hashCode => usbHidUsage.hashCode; @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { if (other.runtimeType != runtimeType) { return false; } - final PhysicalKeyboardKey typedOther = other; - return usbHidUsage == typedOther.usbHidUsage; + return other is PhysicalKeyboardKey + && other.usbHidUsage == usbHidUsage; } @override diff --git a/dev/tools/gen_keycodes/data/keyboard_maps.tmpl b/dev/tools/gen_keycodes/data/keyboard_maps.tmpl index 2b092cfa00..919cd20a95 100644 --- a/dev/tools/gen_keycodes/data/keyboard_maps.tmpl +++ b/dev/tools/gen_keycodes/data/keyboard_maps.tmpl @@ -92,4 +92,3 @@ const Map kWebToPhysicalKey = kWebNumPadMap = { @@@WEB_NUMPAD_MAP@@@ }; -