addAttachment method

Future<Attachment> addAttachment(
  1. {required String name,
  2. required String contentType,
  3. required Uint8List data}
)

Adds a new attachment to this feature.

Parameters:

  • name — The attachment name.
  • contentType — The type of content.
  • data — The attachment data.

Return Value: A Future that returns an Attachment.

Implementation

Future<Attachment> addAttachment(
    {required String name,
    required String contentType,
    required Uint8List data}) {
  final coreName = _CString(name);
  final coreContentType = _CString(contentType);
  final coreData = data.toByteArrayWrapper();
  final taskHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_ArcGISFeature_addAttachment(_handle, coreName.bytes,
        coreContentType.bytes, coreData.ref, errorHandler);
  });
  return taskHandle.toFuture((element) => element.getValueAsAttachment()!);
}