implicit-casts:false in dev (#45787)

This commit is contained in:
Alexandre Ardhuin
2019-12-05 22:34:06 +01:00
committed by GitHub
parent fa0c49d775
commit ec1a015045
68 changed files with 411 additions and 396 deletions

View File

@@ -52,19 +52,19 @@ class AndroidSemanticsNode {
/// ]
/// }
factory AndroidSemanticsNode.deserialize(String value) {
return AndroidSemanticsNode._(json.decode(value));
return AndroidSemanticsNode._(json.decode(value) as Map<String, Object>);
}
final Map<String, Object> _values;
final List<AndroidSemanticsNode> _children = <AndroidSemanticsNode>[];
Map<String, Object> get _flags => _values['flags'];
Map<String, Object> get _flags => _values['flags'] as Map<String, Object>;
/// The text value of the semantics node.
///
/// This is produced by combining the value, label, and hint fields from
/// the Flutter [SemanticsNode].
String get text => _values['text'];
String get text => _values['text'] as String;
/// The contentDescription of the semantics node.
///
@@ -74,7 +74,7 @@ class AndroidSemanticsNode {
///
/// This is produced by combining the value, label, and hint fields from
/// the Flutter [SemanticsNode].
String get contentDescription => _values['contentDescription'];
String get contentDescription => _values['contentDescription'] as String;
/// The className of the semantics node.
///
@@ -83,10 +83,10 @@ class AndroidSemanticsNode {
///
/// If a more specific value isn't provided, it defaults to
/// "android.view.View".
String get className => _values['className'];
String get className => _values['className'] as String;
/// The identifier for this semantics node.
int get id => _values['id'];
int get id => _values['id'] as int;
/// The children of this semantics node.
List<AndroidSemanticsNode> get children => _children;
@@ -94,44 +94,44 @@ class AndroidSemanticsNode {
/// Whether the node is currently in a checked state.
///
/// Equivalent to [SemanticsFlag.isChecked].
bool get isChecked => _flags['isChecked'];
bool get isChecked => _flags['isChecked'] as bool;
/// Whether the node can be in a checked state.
///
/// Equivalent to [SemanticsFlag.hasCheckedState]
bool get isCheckable => _flags['isCheckable'];
bool get isCheckable => _flags['isCheckable'] as bool;
/// Whether the node is editable.
///
/// This is usually only applied to text fields, which map
/// to "android.widget.EditText".
bool get isEditable => _flags['isEditable'];
bool get isEditable => _flags['isEditable'] as bool;
/// Whether the node is enabled.
bool get isEnabled => _flags['isEnabled'];
bool get isEnabled => _flags['isEnabled'] as bool;
/// Whether the node is focusable.
bool get isFocusable => _flags['isFocusable'];
bool get isFocusable => _flags['isFocusable'] as bool;
/// Whether the node is focused.
bool get isFocused => _flags['isFocused'];
bool get isFocused => _flags['isFocused'] as bool;
/// Whether the node is considered a heading.
bool get isHeading => _flags['isHeading'];
bool get isHeading => _flags['isHeading'] as bool;
/// Whether the node represents a password field.
///
/// Equivalent to [SemanticsFlag.isObscured].
bool get isPassword => _flags['isPassword'];
bool get isPassword => _flags['isPassword'] as bool;
/// Whether the node is long clickable.
///
/// Equivalent to having [SemanticsAction.longPress].
bool get isLongClickable => _flags['isLongClickable'];
bool get isLongClickable => _flags['isLongClickable'] as bool;
/// Gets a [Rect] which defines the position and size of the semantics node.
Rect getRect() {
final Map<String, Object> rawRect = _values['rect'];
final Map<String, Object> rawRect = _values['rect'] as Map<String, Object>;
final Map<String, int> rect = rawRect.cast<String, int>();
return Rect.fromLTRB(
rect['left'].toDouble(),
@@ -149,7 +149,7 @@ class AndroidSemanticsNode {
/// Gets a list of [AndroidSemanticsActions] which are defined for the node.
List<AndroidSemanticsAction> getActions() => <AndroidSemanticsAction>[
for (int id in _values['actions']) AndroidSemanticsAction.deserialize(id),
for (int id in (_values['actions'] as List<dynamic>).cast<int>()) AndroidSemanticsAction.deserialize(id),
];
@override
@@ -189,11 +189,11 @@ class Rect {
bool operator ==(Object other) {
if (other.runtimeType != runtimeType)
return false;
final Rect typedOther = other;
return typedOther.top == top &&
typedOther.left == left &&
typedOther.right == right &&
typedOther.bottom == bottom;
return other is Rect
&& other.top == top
&& other.left == left
&& other.right == right
&& other.bottom == bottom;
}
@override
@@ -221,8 +221,9 @@ class Size {
bool operator ==(Object other) {
if (other.runtimeType != runtimeType)
return false;
final Size typedOther = other;
return typedOther.width == width && typedOther.height == height;
return other is Size
&& other.width == width
&& other.height == height;
}
@override

View File

@@ -196,8 +196,8 @@ class AndroidSemanticsAction {
bool operator ==(Object other) {
if (other.runtimeType != runtimeType)
return false;
final AndroidSemanticsAction typedOther = other;
return id == typedOther.id;
return other is AndroidSemanticsAction
&& other.id == id;
}
/// Creates a new [AndroidSemanticsAction] from an integer `value`.

View File

@@ -177,7 +177,7 @@ class _AndroidSemanticsMatcher extends Matcher {
@override
Description describeMismatch(Object item, Description mismatchDescription,
Map<Object, Object> matchState, bool verbose) {
return mismatchDescription.add(matchState['failure']);
return mismatchDescription.add(matchState['failure'] as String);
}
bool _failWithMessage(String value, Map<dynamic, dynamic> matchState) {