Skip to content

Commit

Permalink
Fix linter rules
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Dec 20, 2022
1 parent 8d53f2a commit 86f838b
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions example/lib/download_with_trunks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ Future downloadWithChunks(
final f = File(savePath + 'temp0');
final ioSink = f.openWrite(mode: FileMode.writeOnlyAppend);
for (int i = 1; i < chunk; ++i) {
final _f = File(savePath + 'temp$i');
await ioSink.addStream(_f.openRead());
await _f.delete();
final file = File(savePath + 'temp$i');
await ioSink.addStream(file.openRead());
await file.delete();
}
await ioSink.close();
await f.rename(savePath);
Expand Down
2 changes: 1 addition & 1 deletion example/lib/formdata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void main() async {
data: data3,
onSendProgress: (received, total) {
if (total != -1) {
print((received / total * 100).toStringAsFixed(0) + '%');
print('${(received / total * 100).toStringAsFixed(0)}%');
}
},
);
Expand Down
8 changes: 4 additions & 4 deletions example/lib/queued_interceptor_crsftoken.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ void main() async {
},
));

FutureOr<void> _onResult(d) {
FutureOr<void> onResult(d) {
print('request ok!');
}

/// assume `/test?tag=2` path occurs the authorization error (401)
/// and token to be updated
await dio.get('/test?tag=1').then(_onResult);
await dio.get('/test?tag=2').then(_onResult);
await dio.get('/test?tag=3').then(_onResult);
await dio.get('/test?tag=1').then(onResult);
await dio.get('/test?tag=2').then(onResult);
await dio.get('/test?tag=3').then(onResult);
}
6 changes: 3 additions & 3 deletions example/lib/response_interceptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ void main() async {
} on DioError catch (e) {
assert(e.response!.statusCode == 404);
}
response = await dio.get(urlNotFound + '1');
response = await dio.get('${urlNotFound}1');
assert(response.data == 'fake data');
response = await dio.get(urlNotFound + '2');
response = await dio.get('${urlNotFound}2');
assert(response.data == 'fake data');
try {
await dio.get(urlNotFound + '3');
await dio.get('${urlNotFound}3');
} on DioError catch (e) {
assert(e.message == 'custom error info [404]');
}
Expand Down
2 changes: 1 addition & 1 deletion example_flutter_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MyHomePage extends StatefulWidget {
final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
Expand Down
2 changes: 1 addition & 1 deletion example_flutter_app/lib/routes/request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../http.dart';

class RequestRoute extends StatefulWidget {
@override
_RequestRouteState createState() => _RequestRouteState();
State<RequestRoute> createState() => _RequestRouteState();
}

class _RequestRouteState extends State<RequestRoute> {
Expand Down
2 changes: 1 addition & 1 deletion example_flutter_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
lints: ^1.0.1
lints: any

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
26 changes: 13 additions & 13 deletions plugins/http2_adapter/lib/src/connection_manager_imp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class _ConnectionManager implements ConnectionManager {
final domain = '${uri.host}:${uri.port}';
_ClientTransportConnectionState? transportState = _transportsMap[domain];
if (transportState == null) {
Future<_ClientTransportConnectionState>? _initFuture =
Future<_ClientTransportConnectionState>? initFuture =
_connectFutures[domain];
if (_initFuture == null) {
_connectFutures[domain] = _initFuture = _connect(options);
if (initFuture == null) {
_connectFutures[domain] = initFuture = _connect(options);
}
transportState = await _initFuture;
transportState = await initFuture;
if (_forceClosed) {
transportState.dispose();
} else {
Expand Down Expand Up @@ -108,35 +108,35 @@ class _ConnectionManager implements ConnectionManager {

// Config a ClientTransportConnection and save it
final transport = ClientTransportConnection.viaSocket(socket);
final _transportState = _ClientTransportConnectionState(transport);
final transportState = _ClientTransportConnectionState(transport);
transport.onActiveStateChanged = (bool isActive) {
_transportState.isActive = isActive;
transportState.isActive = isActive;
if (!isActive) {
_transportState.latestIdleTimeStamp = DateTime.now();
transportState.latestIdleTimeStamp = DateTime.now();
}
};
//
_transportState.delayClose(
transportState.delayClose(
_closed ? Duration(milliseconds: 50) : _idleTimeout,
() {
_transportsMap.remove(domain);
_transportState.transport.finish();
transportState.transport.finish();
},
);
return _transportState;
return transportState;
}

@override
void removeConnection(ClientTransportConnection transport) {
_ClientTransportConnectionState? _transportState;
_ClientTransportConnectionState? transportState;
_transportsMap.removeWhere((_, state) {
if (state.transport == transport) {
_transportState = state;
transportState = state;
return true;
}
return false;
});
_transportState?.dispose();
transportState?.dispose();
}

@override
Expand Down
4 changes: 2 additions & 2 deletions plugins/http2_adapter/lib/src/http2_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class Http2Adapter implements HttpClientAdapter {
const excludeMethods = ['PUT', 'POST', 'PATCH'];

if (path.isEmpty || !path.startsWith('/')) {
path = '/' + path;
path = '/$path';
}
if (uri.query.trim().isNotEmpty) {
path += '?' + uri.query;
path += '?${uri.query}';
}
final headers = [
Header.ascii(':method', options.method),
Expand Down

0 comments on commit 86f838b

Please sign in to comment.