getUploadId function
Future<String>
getUploadId({
- required Map<
String, dynamic> fileData, - required BuildContext context,
Get Upload ID
get ID of uploaded file
Implementation
Future<String> getUploadId(
{required Map<String, dynamic> fileData,
required BuildContext context}) async {
final IGraphQlClient _client = AppWrapperBase.of(context)!.graphQLClient;
try {
final http.Response result = await _client
.query(uploadMutation, <String, dynamic>{'input': fileData});
final Map<String, dynamic> body = _client.toMap(result);
//check first for errors
if (_client.parseError(body) != null) {
return 'err';
}
if (body['data'] != null) {
return body['data']['upload']['id'] as String;
} else {
return 'err';
}
} catch (e) {
return 'err';
}
}