fromStreamedResponse static method

Future<SyncResponseException> fromStreamedResponse(
  1. StreamedResponse response
)

Parse an error response from the PowerSync service

Implementation

static Future<SyncResponseException> fromStreamedResponse(
    http.StreamedResponse response) async {
  try {
    final body = await response.stream.bytesToString();
    return _fromResponseBody(response, body);
  } on Exception catch (_) {
    // Could be FormatException, stream issues, or possibly other exceptions.
    // Fallback to just using the response header.
    return _fromResponseHeader(response);
  }
}