Quando o app faz o hot reload aparece o seguinte erro:
ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Exception: SocketException: Connection failed (OS Error: Network is unreachable, errno = 101), address = 192.168.0.174, port = 8080
Eu fiz o teste no postman dando get e post, e funciona corretamente. Segue o código abaixo:
import 'dart:convert';
import 'package:http/http.dart';
import 'package:http_interceptor/http_interceptor.dart';
class LoggingInterceptor implements InterceptorContract {
@override
Future<RequestData> interceptRequest({RequestData data}) async {
print('url ${data.url}');
print('headers ${data.headers}');
print('body ${data.body}');
return data;
}
@override
Future<ResponseData> interceptResponse({ResponseData data}) async {
print(data);
return data;
}
}
void findAll() async {
final Client client = HttpClientWithInterceptor.build(interceptors: [LoggingInterceptor()]);
final Response response = await client.get('http://192.168.0.174:8080/transactions');
final List<dynamic> decodedJson = jsonDecode(response.body);
print(decodedJson);
}