requestAsStream method

Stream<Either> requestAsStream(
  1. Method method,
  2. String route, {
  3. Map<String, String> params = const {},
})

Implementation

Stream<Either> requestAsStream(
  Method method,
  String route, {
  Map<String, String> params = const {},
}) async* {
  Uri uri = _buildUri(route, params);
  http.Response? response;
  try {
    await _makeRequest(method, uri);
    if (_response.statusCode == 200) {
      yield Right(response);
    }
  } catch (e) {
    yield Left(
      Failure(
        _response.statusCode,
        e.toString(),
      ),
    );
  }
}