getWidget method
Implementation
@override
Future<Result<XWidget>> getWidget({
required String widgetId,
required Map<String, String> params,
String? customBaseUrl,
}) async {
var baseUrl = this.baseUrl;
var path = 'v3/api/widgets/$widgetId';
var fullPath = '';
if (buildConfig.isInspectorEnabled) {
if (customBaseUrl != null) {
fullPath = '$customBaseUrl/v3/api/widgets/$widgetId';
}
}
return http.get(
uri: fullPath.isNotEmpty
? fullPath
: Uri.parse('$baseUrl/$path').toString(),
success: (bytes) {
return XWidget()..mergeFromBuffer(bytes);
},
queryParameters: params,
options: const HubbleHTTPRequestOptions(
isProtobuf: true,
receiveTimeout: Duration(minutes: 1),
),
headers: {'Content-Type': 'application/x-protobuf'});
}