Merge pull request #23 from google/make_strong
make package:webkit_inspection_protocol strong
diff --git a/analysis_options.yaml b/analysis_options.yaml
new file mode 100644
index 0000000..a10d4c5
--- /dev/null
+++ b/analysis_options.yaml
@@ -0,0 +1,2 @@
+analyzer:
+ strong-mode: true
diff --git a/lib/dom_model.dart b/lib/dom_model.dart
index f395974..215b9b5 100644
--- a/lib/dom_model.dart
+++ b/lib/dom_model.dart
@@ -45,28 +45,36 @@
WipDomModel(this._dom) {
onAttributeModified =
new StreamTransformer.fromHandlers(handleData: _onAttributeModified)
- .bind(_dom.onAttributeModified)..listen(_logEvent);
+ .bind(_dom.onAttributeModified)
+ ..listen(_logEvent);
onAttributeRemoved =
new StreamTransformer.fromHandlers(handleData: _onAttributeRemoved)
- .bind(_dom.onAttributeRemoved)..listen(_logEvent);
+ .bind(_dom.onAttributeRemoved)
+ ..listen(_logEvent);
onCharacterDataModified =
new StreamTransformer.fromHandlers(handleData: _onCharacterDataModified)
- .bind(_dom.onCharacterDataModified)..listen(_logEvent);
+ .bind(_dom.onCharacterDataModified)
+ ..listen(_logEvent);
onChildNodeCountUpdated =
new StreamTransformer.fromHandlers(handleData: _onChildNodeCountUpdated)
- .bind(_dom.onChildNodeCountUpdated)..listen(_logEvent);
+ .bind(_dom.onChildNodeCountUpdated)
+ ..listen(_logEvent);
onChildNodeInserted =
new StreamTransformer.fromHandlers(handleData: _onChildNodeInserted)
- .bind(_dom.onChildNodeInserted)..listen(_logEvent);
+ .bind(_dom.onChildNodeInserted)
+ ..listen(_logEvent);
onChildNodeRemoved =
new StreamTransformer.fromHandlers(handleData: _onChildNodeRemoved)
- .bind(_dom.onChildNodeRemoved)..listen(_logEvent);
+ .bind(_dom.onChildNodeRemoved)
+ ..listen(_logEvent);
onDocumentUpdated =
new StreamTransformer.fromHandlers(handleData: _onDocumentUpdated)
- .bind(_dom.onDocumentUpdated)..listen(_logEvent);
+ .bind(_dom.onDocumentUpdated)
+ ..listen(_logEvent);
onSetChildNodes =
new StreamTransformer.fromHandlers(handleData: _onSetChildNodes)
- .bind(_dom.onSetChildNodes)..listen(_logEvent);
+ .bind(_dom.onSetChildNodes)
+ ..listen(_logEvent);
}
_logEvent(WipEvent event) {
@@ -282,9 +290,9 @@
if (childNodeCount != null) {
map['childNodeCount'] = childNodeCount;
}
- if (children != null && children.isNotEmpty) {
+ if (_children != null && _children.isNotEmpty) {
var newChildren = [];
- children.forEach((child) {
+ _children.forEach((child) {
if (child != null) {
newChildren.add(child._toJsonInternal(visited));
}
diff --git a/lib/forwarder.dart b/lib/forwarder.dart
index 391244e..05dd72f 100644
--- a/lib/forwarder.dart
+++ b/lib/forwarder.dart
@@ -23,14 +23,14 @@
final WipConnection _debugger;
final WipDom domModel;
- /// If false, no Debugger.paused events will be forwarded back to the
- /// client. This gets automatically set to true if a breakpoint is set
- /// by the client.
+ /// If false, no Debugger.paused events will be forwarded back to the client.
+ /// This gets automatically set to true if a breakpoint is set by the client.
bool forwardPausedEvents = false;
- final _subscriptions = <StreamSubscription>[];
+ final List<StreamSubscription> _subscriptions = <StreamSubscription>[];
- final _closedController = new StreamController.broadcast();
+ final StreamController<Null> _closedController =
+ new StreamController.broadcast();
factory WipForwarder(WipConnection debugger, Stream stream,
{StreamSink sink, WipDom domModel}) {
@@ -106,7 +106,7 @@
}
_log.info('forwarding event: $event');
- var json = {'method': event.method};
+ var json = <String, dynamic>{'method': event.method};
if (event.params != null) {
json['params'] = event.params;
}
diff --git a/lib/src/dom.dart b/lib/src/dom.dart
index 0486ada..edb32a5 100644
--- a/lib/src/dom.dart
+++ b/lib/src/dom.dart
@@ -18,8 +18,8 @@
new Node((await _sendCommand('DOM.getDocument')).result['root']);
Future<String> getOuterHtml(int nodeId) async =>
- (await _sendCommand('DOM.getOuterHTML', {'nodeId': nodeId})).result[
- 'root'];
+ (await _sendCommand('DOM.getOuterHTML', {'nodeId': nodeId}))
+ .result['root'];
Future hideHighlight() => _sendCommand('DOM.hideHighlight');
@@ -29,7 +29,7 @@
Rgba marginColor,
Rgba paddingColor,
bool showInfo}) {
- var params = {'nodeId': nodeId, 'highlightConfig': {}};
+ var params = <String, dynamic>{'nodeId': nodeId, 'highlightConfig': {}};
if (borderColor != null) {
params['highlightConfig']['borderColor'] = borderColor;
@@ -56,7 +56,12 @@
Future highlightRect(int x, int y, int width, int height,
{Rgba color, Rgba outlineColor}) {
- var params = {'x': x, 'y': y, 'width': width, 'height': height};
+ var params = <String, dynamic>{
+ 'x': x,
+ 'y': y,
+ 'width': width,
+ 'height': height
+ };
if (color != null) {
params['color'] = color;
@@ -108,7 +113,7 @@
}
Future<WipRemoteObject> resolveNode(int nodeId, {String objectGroup}) async {
- var params = {'nodeId': nodeId};
+ var params = <String, dynamic>{'nodeId': nodeId};
if (objectGroup != null) {
params['objectGroup'] = objectGroup;
}
diff --git a/lib/webkit_inspection_protocol.dart b/lib/webkit_inspection_protocol.dart
index 6f868b0..46ff1d9 100644
--- a/lib/webkit_inspection_protocol.dart
+++ b/lib/webkit_inspection_protocol.dart
@@ -19,7 +19,6 @@
import 'dart:io' show HttpClient, HttpClientResponse, WebSocket;
import 'package:logging/logging.dart' show Logger;
-
import 'package:logging/logging.dart';
part 'src/console.dart';
@@ -46,7 +45,7 @@
var response = await getUrl('/json');
var respBody = await UTF8.decodeStream(response);
List<Map<String, String>> data = JSON.decode(respBody);
- return data.map((m) => new ChromeTab(m));
+ return data.map((m) => new ChromeTab(m)).toList();
}
Future<ChromeTab> getTab(bool accept(ChromeTab tab),