deleteDocument method

  1. @override
Future<void> deleteDocument(
  1. ModelAdapterDocumentQuery query
)
inherited

Delete data from the platform set by the adapter by passing query.

queryを渡すことでアダプターで設定されたプラットフォームからデータを削除します。

Implementation

@override
Future<void> deleteDocument(ModelAdapterDocumentQuery query) async {
  _assert();
  if (validator != null) {
    final oldValue =
        _FirestoreCache.getCache(options).get(_path(query.query.path));
    await validator!.onDeleteDocument(query, oldValue);
  }
  if (onInitialize != null) {
    await onInitialize?.call(options);
  } else {
    await FirebaseCore.initialize(options: options);
  }
  await _documentReference(query).delete();
  await cachedRuntimeDatabase.deleteDocument(query, prefix: prefix);
  _FirestoreCache.getCache(options).set(_path(query.query.path));
  await onDeleteDocument(query);
}