add missing type parameter on methods (#22096)

This commit is contained in:
Alexandre Ardhuin
2018-10-01 21:29:08 +02:00
committed by GitHub
parent 48fb726b01
commit f62afdcf57
211 changed files with 504 additions and 503 deletions

View File

@@ -78,7 +78,7 @@ final Duration _kPauseBetweenReconnectAttempts = _kShortTimeout ~/ 5;
// See https://github.com/dart-lang/sdk/blob/master/runtime/vm/timeline.cc#L32
String _timelineStreamsToString(List<TimelineStream> streams) {
final String contents = streams.map((TimelineStream stream) {
final String contents = streams.map<String>((TimelineStream stream) {
switch (stream) {
case TimelineStream.all: return 'all';
case TimelineStream.api: return 'API';
@@ -428,7 +428,7 @@ class FlutterDriver {
/// The move events are generated at a given [frequency] in Hz (or events per
/// second). It defaults to 60Hz.
Future<Null> scroll(SerializableFinder finder, double dx, double dy, Duration duration, { int frequency = 60, Duration timeout }) async {
return await _sendCommand(Scroll(finder, dx, dy, duration, frequency, timeout: timeout)).then((Map<String, dynamic> _) => null);
return await _sendCommand(Scroll(finder, dx, dy, duration, frequency, timeout: timeout)).then<Null>((Map<String, dynamic> _) => null);
}
/// Scrolls the Scrollable ancestor of the widget located by [finder]
@@ -439,7 +439,7 @@ class FlutterDriver {
/// then this method may fail because [finder] doesn't actually exist.
/// The [scrollUntilVisible] method can be used in this case.
Future<Null> scrollIntoView(SerializableFinder finder, { double alignment = 0.0, Duration timeout }) async {
return await _sendCommand(ScrollIntoView(finder, alignment: alignment, timeout: timeout)).then((Map<String, dynamic> _) => null);
return await _sendCommand(ScrollIntoView(finder, alignment: alignment, timeout: timeout)).then<Null>((Map<String, dynamic> _) => null);
}
/// Repeatedly [scroll] the widget located by [scrollable] by [dxScroll] and
@@ -483,7 +483,7 @@ class FlutterDriver {
// the chance to complete if the item is already onscreen; if not, scroll
// repeatedly until we either find the item or time out.
bool isVisible = false;
waitFor(item, timeout: timeout).then((Null value) { isVisible = true; });
waitFor(item, timeout: timeout).then<void>((Null value) { isVisible = true; });
await Future<Null>.delayed(const Duration(milliseconds: 500));
while (!isVisible) {
await scroll(scrollable, dxScroll, dyScroll, const Duration(milliseconds: 100));

View File

@@ -129,6 +129,6 @@ List<TimelineEvent> _parseEvents(Map<String, dynamic> json) {
// TODO(vegorov): use instance method version of castFrom when it is available.
return Iterable.castFrom<dynamic, Map<String, dynamic>>(jsonEvents)
.map((Map<String, dynamic> eventJson) => TimelineEvent(eventJson))
.map<TimelineEvent>((Map<String, dynamic> eventJson) => TimelineEvent(eventJson))
.toList();
}

View File

@@ -98,10 +98,10 @@ class TimelineSummary {
'missed_frame_rasterizer_budget_count': computeMissedFrameRasterizerBudgetCount(),
'frame_count': countFrames(),
'frame_build_times': _extractFrameDurations()
.map((Duration duration) => duration.inMicroseconds)
.map<int>((Duration duration) => duration.inMicroseconds)
.toList(),
'frame_rasterizer_times': _extractGpuRasterizerDrawEvents()
.map((TimedEvent event) => event.duration.inMicroseconds)
.map<int>((TimedEvent event) => event.duration.inMicroseconds)
.toList(),
};
}
@@ -143,7 +143,7 @@ class TimelineSummary {
}
List<Duration> _extractDurations(String name) {
return _extractNamedEvents(name).map((TimelineEvent event) => event.duration).toList();
return _extractNamedEvents(name).map<Duration>((TimelineEvent event) => event.duration).toList();
}
/// Extracts timed events that are reported as a pair of begin/end events.
@@ -199,7 +199,7 @@ class TimelineSummary {
List<Duration> _extractFrameDurations() => _extractDurations('Frame');
Iterable<Duration> _extractDuration(Iterable<TimedEvent> events) {
return events.map((TimedEvent e) => e.duration);
return events.map<Duration>((TimedEvent e) => e.duration);
}
}

View File

@@ -28,7 +28,7 @@ void main() {
MockPeer mockPeer;
void expectLogContains(String message) {
expect(log.map((LogRecord r) => '$r'), anyElement(contains(message)));
expect(log.map<String>((LogRecord r) => '$r'), anyElement(contains(message)));
}
setUp(() {