fetchView method
Implementation
Future<BeagleUIElement> fetchView(RemoteView route) async {
final response = await httpClient.sendRequest(BeagleRequest(
urlBuilder.build(route.url),
method: route.httpAdditionalData?.method,
headers: route.httpAdditionalData?.headers,
body: _convertBodyToString(route.httpAdditionalData?.body),
));
if (response.status < 400) return BeagleUIElement(json.decode(response.body));
if (route.fallback != null) return route.fallback!;
throw ErrorDescription(
"${route.httpAdditionalData?.method ?? "GET"} ${urlBuilder.build(route.url)}. Response status: ${response.status}");
}