0
I have a request by stream which is as follows:.
Future<Stream<Chamado>> getChamado() async{
final String url = 'www.api'
final client = new http.Client();
final streamRest = await client.send(
http.Request('get',Uri.parse(url))
);
return streamRest.stream
.transform(utf8.decoder)
.transform(json.decoder)
.expand((data) => (data as List))
.map((data) => Chamado.fromJSON(data));
}
How do I place a header in this request, using the client.send
unseen client.get
? has as ?
The only thing I modified to work was the authorization header. Instead of :
request.headers[HttpHeaders.authorizationHeader] = 'Basic ${token}';
I put :request.headers['Authorizarion'] = 'Bearer ${token}';
– Tiago Gomes Oliveira