Skip to content

Commit 5bdb2c0

Browse files
committed
Address lints
1 parent a3c1799 commit 5bdb2c0

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

pkgs/http_profile/lib/http_profile.dart

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ final class HttpProfileProxyData {
4949

5050
/// Describes a redirect that an HTTP connection went through.
5151
class HttpProfileRedirectData {
52-
int _statusCode;
53-
String _method;
54-
String _location;
52+
final int _statusCode;
53+
final String _method;
54+
final String _location;
5555

5656
HttpProfileRedirectData({
5757
required int statusCode,
@@ -85,7 +85,8 @@ final class HttpProfileRequestData {
8585
for (final v in value.values) {
8686
if (!(v is String || v is int)) {
8787
throw ArgumentError(
88-
"The values in connectionInfo must be of type String or int.");
88+
'The values in connectionInfo must be of type String or int.',
89+
);
8990
}
9091
}
9192
_data['connectionInfo'] = {...value};
@@ -149,8 +150,8 @@ final class HttpProfileRequestData {
149150
}
150151

151152
const HttpProfileRequestData._(
152-
Map<String, dynamic> this._data,
153-
void Function() this._updated,
153+
this._data,
154+
this._updated,
154155
);
155156
}
156157

@@ -162,7 +163,7 @@ final class HttpProfileResponseData {
162163

163164
/// Records a redirect that the connection went through.
164165
void addRedirect(HttpProfileRedirectData redirect) {
165-
_data['redirects'].add(redirect._toJson());
166+
(_data['redirects'] as List<Map<String, dynamic>>).add(redirect._toJson());
166167
_updated();
167168
}
168169

@@ -192,7 +193,8 @@ final class HttpProfileResponseData {
192193
for (final v in value.values) {
193194
if (!(v is String || v is int)) {
194195
throw ArgumentError(
195-
"The values in connectionInfo must be of type String or int.");
196+
'The values in connectionInfo must be of type String or int.',
197+
);
196198
}
197199
}
198200
_data['connectionInfo'] = {...value};
@@ -262,8 +264,8 @@ final class HttpProfileResponseData {
262264
}
263265

264266
HttpProfileResponseData._(
265-
Map<String, dynamic> this._data,
266-
void Function() this._updated,
267+
this._data,
268+
this._updated,
267269
) {
268270
_data['redirects'] = <Map<String, dynamic>>[];
269271
}
@@ -290,7 +292,7 @@ final class HttpClientRequestProfile {
290292
/// profile.addEvent(HttpProfileRequestEvent(DateTime.now(), "Remote Disconnected");
291293
/// ```
292294
void addEvent(HttpProfileRequestEvent event) {
293-
_data['events'].add(event._toJson());
295+
(_data['events'] as List<Map<String, dynamic>>).add(event._toJson());
294296
_updated();
295297
}
296298

@@ -326,7 +328,8 @@ final class HttpClientRequestProfile {
326328
return _responseBody.sink;
327329
}
328330

329-
void _updated() => _data['_lastUpdateTime'] = Timeline.now;
331+
void _updated() =>
332+
_data['_lastUpdateTime'] = DateTime.now().microsecondsSinceEpoch;
330333

331334
HttpClientRequestProfile._({
332335
required DateTime requestStartTimestamp,
@@ -349,7 +352,7 @@ final class HttpClientRequestProfile {
349352
_data['_responseBodyStream'] = _responseBody.stream;
350353
// This entry is needed to support the updatedSince parameter of
351354
// ext.dart.io.getHttpProfile.
352-
_data['_lastUpdateTime'] = Timeline.now;
355+
_data['_lastUpdateTime'] = DateTime.now().microsecondsSinceEpoch;
353356
}
354357

355358
/// If HTTP profiling is enabled, returns an [HttpClientRequestProfile],
@@ -374,10 +377,7 @@ final class HttpClientRequestProfile {
374377
requestMethod: requestMethod,
375378
requestUri: requestUri,
376379
);
377-
// This entry is needed to support the id parameter of
378-
// ext.dart.io.getHttpProfileRequest.
379-
requestProfile._data['id'] =
380-
addHttpClientProfilingData(requestProfile._data);
380+
addHttpClientProfilingData(requestProfile._data);
381381
return requestProfile;
382382
}
383383
}

0 commit comments

Comments
 (0)