【发布时间】:2019-07-17 13:46:55
【问题描述】:
几天来,当我从端点 Exception has occurred. ClientException (Connection closed before full header was received) 加载数据时,我一直收到此错误
import 'package:http/http.dart' show Client;
Client client = Client();
Future<Platoons> fetchMeatifyById(String id) async {
final response = await client.get('$_baseApi/platoons/$id');
if (response.statusCode == 200 || response.statusCode == 201) {
return Platoons(json.decode(response.body));
} else {
throw Exception('Failed to load platoon');
}
}
【问题讨论】: