Add @override annotations to flutter framework

This commit is contained in:
Hixie
2016-03-14 13:31:43 -07:00
parent 9bc6d281fe
commit 797e27edd3
322 changed files with 2544 additions and 9 deletions

View File

@@ -15,6 +15,7 @@ class DriverError extends Error {
final dynamic originalError;
final dynamic originalStackTrace;
@override
String toString() {
return '''DriverError: $message
Original error: $originalError
@@ -56,6 +57,7 @@ class LogRecord {
final String loggerName;
final String message;
@override
String toString() => '[${"$level".split(".").last}] $loggerName: $message';
}

View File

@@ -13,12 +13,14 @@ DriverError _createInvalidKeyValueTypeError(String invalidType) {
/// Command to find an element.
class Find extends Command {
@override
final String kind = 'find';
Find(this.searchSpec);
final SearchSpecification searchSpec;
@override
Map<String, String> serialize() => searchSpec.serialize();
static Find deserialize(Map<String, String> json) {
@@ -47,6 +49,7 @@ abstract class SearchSpecification {
/// Tells [Find] to search by tooltip text.
class ByTooltipMessage extends SearchSpecification {
@override
final String searchSpecType = 'ByTooltipMessage';
ByTooltipMessage(this.text);
@@ -54,6 +57,7 @@ class ByTooltipMessage extends SearchSpecification {
/// Tooltip message text.
final String text;
@override
Map<String, String> serialize() => super.serialize()..addAll({
'text': text,
});
@@ -65,12 +69,14 @@ class ByTooltipMessage extends SearchSpecification {
/// Tells [Find] to search for `Text` widget by text.
class ByText extends SearchSpecification {
@override
final String searchSpecType = 'ByText';
ByText(this.text);
final String text;
@override
Map<String, String> serialize() => super.serialize()..addAll({
'text': text,
});
@@ -82,6 +88,7 @@ class ByText extends SearchSpecification {
/// Tells [Find] to search by `ValueKey`.
class ByValueKey extends SearchSpecification {
@override
final String searchSpecType = 'ByValueKey';
ByValueKey(dynamic keyValue)
@@ -103,6 +110,7 @@ class ByValueKey extends SearchSpecification {
/// May be one of "String", "int". The list of supported types may change.
final String keyValueType;
@override
Map<String, String> serialize() => super.serialize()..addAll({
'keyValueString': keyValueString,
'keyValueType': keyValueType,
@@ -127,12 +135,14 @@ class GetText extends CommandWithTarget {
/// [targetRef] identifies an element that contains a piece of text.
GetText(ObjectRef targetRef) : super(targetRef);
@override
final String kind = 'get_text';
static GetText deserialize(Map<String, String> json) {
return new GetText(new ObjectRef(json['targetRef']));
}
@override
Map<String, String> serialize() => super.serialize();
}
@@ -145,6 +155,7 @@ class GetTextResult extends Result {
return new GetTextResult(json['text']);
}
@override
Map<String, dynamic> toJson() => {
'text': text,
};

View File

@@ -5,6 +5,7 @@
import 'message.dart';
class Tap extends CommandWithTarget {
@override
final String kind = 'tap';
Tap(ObjectRef targetRef) : super(targetRef);
@@ -13,6 +14,7 @@ class Tap extends CommandWithTarget {
return new Tap(new ObjectRef(json['targetRef']));
}
@override
Map<String, String> serialize() => super.serialize();
}
@@ -21,12 +23,14 @@ class TapResult extends Result {
return new TapResult();
}
@override
Map<String, dynamic> toJson() => {};
}
/// Command the driver to perform a scrolling action.
class Scroll extends CommandWithTarget {
@override
final String kind = 'scroll';
Scroll(
@@ -59,6 +63,7 @@ class Scroll extends CommandWithTarget {
/// The frequency in Hz of the generated move events.
final int frequency;
@override
Map<String, String> serialize() => super.serialize()..addAll({
'dx': '$dx',
'dy': '$dy',
@@ -72,5 +77,6 @@ class ScrollResult extends Result {
return new ScrollResult();
}
@override
Map<String, dynamic> toJson() => {};
}

View File

@@ -7,10 +7,12 @@ import 'message.dart';
/// Requests an application health check.
class GetHealth implements Command {
@override
final String kind = 'get_health';
static GetHealth deserialize(Map<String, String> json) => new GetHealth();
@override
Map<String, String> serialize() => const {};
}
@@ -39,6 +41,7 @@ class Health extends Result {
/// Health status
final HealthStatus status;
@override
Map<String, dynamic> toJson() => {
'status': _healthStatusIndex.toSimpleName(status)
};

View File

@@ -36,19 +36,23 @@ class MatchResult {
class _TextDescription implements Description {
final StringBuffer _text = new StringBuffer();
@override
int get length => _text.length;
@override
Description add(String text) {
_text.write(text);
return this;
}
@override
Description replace(String text) {
_text.clear();
_text.write(text);
return this;
}
@override
Description addDescriptionOf(dynamic value) {
if (value is Matcher) {
value.describe(this);
@@ -58,6 +62,7 @@ class _TextDescription implements Description {
}
}
@override
Description addAll(String start, String separator, String end, Iterable<dynamic> list) {
add(start);
if (list.isNotEmpty) {
@@ -71,5 +76,6 @@ class _TextDescription implements Description {
return this;
}
@override
String toString() => '$_text';
}

View File

@@ -39,6 +39,7 @@ class ObjectRef extends Result {
/// tests should not generate these keys.
final String objectReferenceKey;
@override
Map<String, dynamic> toJson() => {
'objectReferenceKey': objectReferenceKey,
};
@@ -69,6 +70,7 @@ abstract class CommandWithTarget extends Command {
/// Map<String, String> toJson() => super.toJson()..addAll({
/// 'foo': this.foo,
/// });
@override
Map<String, String> serialize() => <String, String>{
'targetRef': targetRef,
};