Skip to content

Commit 14c020b

Browse files
author
Matteo Crippa
committed
cleanup code for handleLine
1 parent 5f1949c commit 14c020b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/flutter_tools/lib/src/protocol_discovery.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ class ProtocolDiscovery {
6060
void _handleLine(String line) {
6161
Uri uri;
6262

63-
final RegExp _regexp = new RegExp('${RegExp.escape(serviceName)} (http://[^ \n]+)');
64-
final Match _match = _regexp.firstMatch(line);
63+
final RegExp r = new RegExp('$serviceName (http://[^ \n]+)');
64+
final Match match = r.firstMatch(line);
6565

66-
if (_match != null) {
66+
if (match != null) {
6767
try {
68-
uri = Uri.parse(_match[1]);
68+
uri = Uri.parse(match[1]);
6969
} catch (error) {
7070
_stopScrapingLogs();
7171
_completer.completeError(error);
@@ -87,7 +87,8 @@ class ProtocolDiscovery {
8787
final int actualDevicePort = deviceUri.port;
8888
final int actualHostPort =
8989
await portForwarder.forward(actualDevicePort, hostPort: hostPort);
90-
printTrace('Forwarded host port $actualHostPort to device port $actualDevicePort for $serviceName');
90+
printTrace(
91+
'Forwarded host port $actualHostPort to device port $actualDevicePort for $serviceName');
9192
hostUri = deviceUri.replace(port: actualHostPort);
9293
}
9394

0 commit comments

Comments
 (0)