loadForm method
Loads a FormData represented by formUri
headers
will be added in addition to ApptiveGridClient.defaultHeaders
Based on formUri
this might require Authentication
throws Response
if the request fails
Implementation
Future<FormData> loadForm({
required Uri uri,
Map<String, String> headers = const {},
bool isRetry = false,
}) async {
final url = _generateApptiveGridUri(uri);
final sanitizedUrl =
url.replace(path: url.path.replaceAll(RegExp('/r/'), '/a/'));
final data = await performApptiveLink<FormData>(
link: ApptiveLink(uri: sanitizedUrl, method: 'get'),
headers: headers,
parseResponse: (response) async {
return FormData.fromJson(json.decode(response.body));
},
);
return data!;
}