Mesmo seguindo os passos do curso, recebi esse erro ao verificar as respostas do "LoggingInspector". Vou colocar abaixo a resposta do meu console que me devolveu o request mas não o response e o meu código. Se puderem me ajudar, seria bem legal.
Console Debug:
Built build/app/outputs/flutter-apk/app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:58913/ztjOuGW91Hg=/ws
I/flutter (28668): Request
I/flutter (28668): url http://192.168.0.10:8080/transactions
I/flutter (28668): headers: {}
I/flutter (28668): body:
E/flutter (28668): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Bad state: Insecure HTTP is not allowed by platform: http://192.168.0.10:8080/transactions
E/flutter (28668): #0 _HttpClient._openUrl (dart:_http/http_impl.dart:2435:7)
E/flutter (28668): #1 _HttpClient.openUrl (dart:_http/http_impl.dart:2342:7)
E/flutter (28668): #2 IOClient.send package:http/src/io_client.dart:31
E/flutter (28668): #3 HttpClientWithInterceptor.send package:http_interceptor/http_client_with_interceptor.dart:148
E/flutter (28668): #4 HttpClientWithInterceptor._attemptRequest
package:http_interceptor/http_client_with_interceptor.dart:208
E/flutter (28668): <asynchronous suspension>
E/flutter (28668): #5 HttpClientWithInterceptor._sendUnstreamed
E/flutter (28668): #6 HttpClientWithInterceptor.get
package:http_interceptor/http_client_with_interceptor.dart:86
E/flutter (28668): #7 findAll package:bytebank/http/webclient.dart:30
E/flutter (28668): #8 main package:bytebank/main.dart:8
E/flutter (28668): #9 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:231:25)
E/flutter (28668): #10 _rootRun (dart:async/zone.dart:1190:13)
E/flutter (28668): #11 _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter (28668): #12 _runZoned (dart:async/zone.dart:1630:10)
E/flutter (28668): #13 runZonedGuarded (dart:async/zone.dart:1618:12)
E/flutter (28668): #14 _runMainZoned.<anonymous closure (dart:ui/hooks.dart:223:5)
E/flutter (28668): #15 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:301:19)
E/flutter (28668): #16 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
E/flutter (28668):
import 'package:http/http.dart';
import 'package:http_interceptor/http_interceptor.dart';
class LoggingInterceptor implements InterceptorContract {
@override
Future<RequestData> interceptRequest({RequestData data}) async {
print('Request');
print('url ${data.url}');
print('headers: ${data.headers}');
print('body: ${data.body}');
return data;
}
@override
Future<ResponseData> interceptResponse({ResponseData data}) async {
print('Response');
print('status code: ${data.statusCode}');
print('headers: ${data.headers}');
print('body: ${data.body}');
return data;
}
}
void findAll() async {
final Client client = HttpClientWithInterceptor.build(
interceptors: [LoggingInterceptor()],
);
final Response response =
await client.get('http://192.168.0.10:8080/transactions');
}