Skip to content

Commit

Permalink
🚨 Apply avoid_void_async (cfug#2168)
Browse files Browse the repository at this point in the history
Quick format to the library.
  • Loading branch information
AlexV525 authored Mar 28, 2024
1 parent 7bb44ee commit e7aca5e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ analyzer:

linter:
rules:
avoid_void_async: true
prefer_final_locals: true
prefer_final_in_for_each: true
prefer_single_quotes: true
Expand Down
6 changes: 3 additions & 3 deletions dio/lib/src/interceptors/log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class LogInterceptor extends Interceptor {
void onRequest(
RequestOptions options,
RequestInterceptorHandler handler,
) async {
) {
logPrint('*** Request ***');
_printKV('uri', options.uri);
//options.headers;
Expand Down Expand Up @@ -97,14 +97,14 @@ class LogInterceptor extends Interceptor {
}

@override
void onResponse(Response response, ResponseInterceptorHandler handler) async {
void onResponse(Response response, ResponseInterceptorHandler handler) {
logPrint('*** Response ***');
_printResponse(response);
handler.next(response);
}

@override
void onError(DioException err, ErrorInterceptorHandler handler) async {
void onError(DioException err, ErrorInterceptorHandler handler) {
if (error) {
logPrint('*** DioException ***:');
logPrint('uri: ${err.requestOptions.uri}');
Expand Down
13 changes: 7 additions & 6 deletions dio/test/options_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,8 @@ void main() {

test('Throws when using invalid methods', () async {
final dio = Dio();
void testInvalidArgumentException(String method) async {

Future<void> testInvalidArgumentException(String method) async {
await expectLater(
dio.fetch(RequestOptions(path: 'http://127.0.0.1', method: method)),
throwsA((e) => e is DioException && e.error is ArgumentError),
Expand All @@ -501,11 +502,11 @@ void main() {
const String separators = '\t\n\r()<>@,;:\\/[]?={}';
for (int i = 0; i < separators.length; i++) {
final String separator = separators.substring(i, i + 1);
testInvalidArgumentException(separator);
testInvalidArgumentException('${separator}CONNECT');
testInvalidArgumentException('CONN${separator}ECT');
testInvalidArgumentException('CONN$separator${separator}ECT');
testInvalidArgumentException('CONNECT$separator');
await testInvalidArgumentException(separator);
await testInvalidArgumentException('${separator}CONNECT');
await testInvalidArgumentException('CONN${separator}ECT');
await testInvalidArgumentException('CONN$separator${separator}ECT');
await testInvalidArgumentException('CONNECT$separator');
}
});

Expand Down

0 comments on commit e7aca5e

Please sign in to comment.