enable lint prefer_final_in_for_each (#47724)
This commit is contained in:
committed by
GitHub
parent
fa337f5922
commit
4f9b6cf017
@@ -36,13 +36,13 @@ Future<void> main(List<String> args) async {
|
||||
final FuchsiaRemoteConnection connection =
|
||||
await FuchsiaRemoteConnection.connect(address, interface, sshConfigPath);
|
||||
print('On $address, the following Dart VM ports are running:');
|
||||
for (int port in await connection.getDeviceServicePorts()) {
|
||||
for (final int port in await connection.getDeviceServicePorts()) {
|
||||
print('\t$port');
|
||||
}
|
||||
print('');
|
||||
|
||||
print('The following Flutter views are running:');
|
||||
for (FlutterView view in await connection.getFlutterViews()) {
|
||||
for (final FlutterView view in await connection.getFlutterViews()) {
|
||||
print('\t${view.name ?? view.id}');
|
||||
}
|
||||
await connection.stop();
|
||||
|
||||
@@ -170,7 +170,7 @@ class DartVm {
|
||||
final Map<String, dynamic> jsonVmRef =
|
||||
await invokeRpc('getVM', timeout: timeout);
|
||||
final List<IsolateRef> result = <IsolateRef>[];
|
||||
for (Map<String, dynamic> jsonIsolate in jsonVmRef['isolates']) {
|
||||
for (final Map<String, dynamic> jsonIsolate in jsonVmRef['isolates']) {
|
||||
final String name = jsonIsolate['name'] as String;
|
||||
if (pattern.matchAsPrefix(name) != null) {
|
||||
_log.fine('Found Isolate matching "$pattern": "$name"');
|
||||
@@ -213,7 +213,7 @@ class DartVm {
|
||||
final List<FlutterView> views = <FlutterView>[];
|
||||
final Map<String, dynamic> rpcResponse =
|
||||
await invokeRpc('_flutter.listViews', timeout: timeout);
|
||||
for (Map<String, dynamic> jsonView in rpcResponse['views']) {
|
||||
for (final Map<String, dynamic> jsonView in rpcResponse['views']) {
|
||||
final FlutterView flutterView = FlutterView._fromJson(jsonView);
|
||||
if (flutterView != null) {
|
||||
views.add(flutterView);
|
||||
|
||||
@@ -221,7 +221,7 @@ class FuchsiaRemoteConnection {
|
||||
/// those objects) will subsequently have its connection closed as well, so
|
||||
/// behavior for them will be undefined.
|
||||
Future<void> stop() async {
|
||||
for (PortForwarder pf in _forwardedVmServicePorts) {
|
||||
for (final PortForwarder pf in _forwardedVmServicePorts) {
|
||||
// Closes VM service first to ensure that the connection is closed cleanly
|
||||
// on the target before shutting down the forwarding itself.
|
||||
final DartVm vmService = _dartVmCache[pf.port];
|
||||
@@ -229,7 +229,7 @@ class FuchsiaRemoteConnection {
|
||||
await vmService?.stop();
|
||||
await pf.stop();
|
||||
}
|
||||
for (PortForwarder pf in _dartVmPortMap.values) {
|
||||
for (final PortForwarder pf in _dartVmPortMap.values) {
|
||||
final DartVm vmService = _dartVmCache[pf.port];
|
||||
_dartVmCache[pf.port] = null;
|
||||
await vmService?.stop();
|
||||
@@ -305,7 +305,7 @@ class FuchsiaRemoteConnection {
|
||||
// simultaneously via Future.wait.
|
||||
final List<Future<List<IsolateRef>>> isolates =
|
||||
<Future<List<IsolateRef>>>[];
|
||||
for (PortForwarder fp in _dartVmPortMap.values) {
|
||||
for (final PortForwarder fp in _dartVmPortMap.values) {
|
||||
final DartVm vmService =
|
||||
await _getDartVm(fp.port, timeout: vmConnectionTimeout);
|
||||
if (vmService == null) {
|
||||
@@ -390,7 +390,7 @@ class FuchsiaRemoteConnection {
|
||||
}
|
||||
}
|
||||
|
||||
for (PortForwarder pf in _dartVmPortMap.values) {
|
||||
for (final PortForwarder pf in _dartVmPortMap.values) {
|
||||
final DartVm service = await _getDartVm(pf.port);
|
||||
if (service == null) {
|
||||
await shutDownPortForwarder(pf);
|
||||
@@ -448,7 +448,7 @@ class FuchsiaRemoteConnection {
|
||||
Future<void> _pollVms() async {
|
||||
await _checkPorts();
|
||||
final List<int> servicePorts = await getDeviceServicePorts();
|
||||
for (int servicePort in servicePorts) {
|
||||
for (final int servicePort in servicePorts) {
|
||||
if (!_stalePorts.contains(servicePort) &&
|
||||
!_dartVmPortMap.containsKey(servicePort)) {
|
||||
_dartVmPortMap[servicePort] = await fuchsiaPortForwardingFunction(
|
||||
@@ -499,7 +499,7 @@ class FuchsiaRemoteConnection {
|
||||
_sshCommandRunner.sshConfigPath);
|
||||
}));
|
||||
|
||||
for (PortForwarder pf in forwardedVmServicePorts) {
|
||||
for (final PortForwarder pf in forwardedVmServicePorts) {
|
||||
// TODO(awdavies): Handle duplicates.
|
||||
_dartVmPortMap[pf.remotePort] = pf;
|
||||
}
|
||||
@@ -521,13 +521,13 @@ class FuchsiaRemoteConnection {
|
||||
final List<String> portPaths = await _sshCommandRunner
|
||||
.run('/bin/find /hub -name vmservice-port');
|
||||
final List<int> ports = <int>[];
|
||||
for (String path in portPaths) {
|
||||
for (final String path in portPaths) {
|
||||
if (path == '') {
|
||||
continue;
|
||||
}
|
||||
final List<String> lsOutput =
|
||||
await _sshCommandRunner.run('/bin/ls $path');
|
||||
for (String line in lsOutput) {
|
||||
for (final String line in lsOutput) {
|
||||
if (line == '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user