Skip to content

Commit

Permalink
cv_firstore get back set exists
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Feb 24, 2025
1 parent e1e2ba2 commit f22d9a8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app_cv_firestore/lib/src/v2/cv_document.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ mixin _WithPath implements CvFirestoreDocument {
@override
bool get hasId => _path != null;

/// Do no use unless you know what you are doing
@Deprecated('Do not use unless you know what you are doing')
set exists(bool exists) => _exists = exists;

/// Can only be called on read documents
@override
bool get exists => _exists ?? false;
Expand Down Expand Up @@ -64,7 +68,9 @@ extension CvFirestoreDocumentPrvExt on CvFirestoreDocument {
}

/// Only the content is compared on equals
abstract class CvFirestoreDocumentBase extends CvModelBase with _WithPath {}
abstract class CvFirestoreDocumentBase extends CvModelBase
with _WithPath
implements CvFirestoreDocument {}

/// Only the content is compared on equals
abstract class CvFirestoreDocument implements CvModel {
Expand Down
2 changes: 1 addition & 1 deletion app_cv_firestore/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ dependencies:
version: '>=0.9.0'
dev_dependencies:
test: ">=1.24.0"
dev_build: ">=1.1.0+2"
dev_build: ">=1.1.2"

3 changes: 3 additions & 0 deletions app_cv_firestore/test/app_cv_firestore_v2_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ void main() {
expect(cvFsEmpty.path, 'test/1');
expect(cvFsEmpty.exists, false);
expect(cvFsEmpty.toMap(), isEmpty);
// ignore: deprecated_member_use_from_same_package
cvFsEmpty.exists = true;
expect(cvFsEmpty.exists, true);

await firestore.cvSet(cvFsEmpty);
cvFsEmpty = await firestore.cvGet<CvFsEmpty>('test/1');
Expand Down

0 comments on commit f22d9a8

Please sign in to comment.