-
Notifications
You must be signed in to change notification settings - Fork 29.4k
Closed
Description
I'm using Dart 2 and when I try to make an HTTP GET request, This error is shown
[ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (21922): type '_BoundSinkStream<dynamic, List<int>>' is not a subtype of type '_HttpIncoming' where
E/flutter (21922): _BoundSinkStream is from dart:async
E/flutter (21922): List is from dart:core
E/flutter (21922): int is from dart:core
E/flutter (21922): List is from dart:core
E/flutter (21922): int is from dart:core
E/flutter (21922): _HttpIncoming is from dart:_http
E/flutter (21922): List is from dart:core
E/flutter (21922): int is from dart:core
this is my code
Future<Stream<Device>> getDevices() async {
var httpClient = HttpClient();
var uri = Uri.http('x.aba.ae', '/x.php');
HttpClientRequest request = await httpClient.getUrl(uri);
HttpClientResponse response = await request.close();
return response
.transform(UTF8.decoder)
.transform(JSON.decoder)
.asyncMap((json) => Device.fromJson(json));
}
Metadata
Metadata
Assignees
Labels
No labels