deleteTag method

Future<void> deleteTag(
  1. String key
)

Implementation

Future<void> deleteTag(String key) async {
  try {
    final ProductTag tagToDelete = ProductTag(
      barcode: barcode,
      key: key,
      value: '',
      owner: '',
      version: _getCurrentTagVersion(key),
      editor: '',
      lastEdit: DateTime.now(),
      comment: '',
    );

    await _addOperation(
      barcode,
      FolksonomyOperation(type: FolksonomyAction.remove, tag: tagToDelete),
    );
    unawaited(_refreshDisplayableTags());
  } catch (e) {
    value = FolksonomyStateError(
      error: e,
      action: FolksonomyAction.remove,
      tags: _tags,
    );
  }
}