Skip to content

Commit 6e41bcb

Browse files
authored
fix(cloud_firestore): remove get-write validation (#2919)
* fix(cloud_firestore): remove get-write validation * remove invalid test
1 parent 9c9faba commit 6e41bcb

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

packages/cloud_firestore/cloud_firestore_platform_interface/lib/src/method_channel/method_channel_transaction.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,11 @@ class MethodChannelTransaction extends TransactionPlatform {
2626
FirebaseFirestorePlatform.instanceFor(app: Firebase.app(appName));
2727
}
2828

29-
int _documentGetCount = 0;
30-
3129
List<Map<String, dynamic>> _commands = [];
3230

3331
/// Returns all transaction commands for the current instance.
34-
///
35-
/// All get operations must be written, otherwise an [AssertionError] will be thrown
3632
@override
3733
List<Map<String, dynamic>> get commands {
38-
if (_documentGetCount > 0) {
39-
assert(_documentGetCount <= _commands.length,
40-
"All transaction get operations must also be written.");
41-
}
42-
4334
return _commands;
4435
}
4536

@@ -58,7 +49,6 @@ class MethodChannelTransaction extends TransactionPlatform {
5849
'transactionId': _transactionId,
5950
'reference': _firestore.doc(documentPath),
6051
});
61-
_documentGetCount++;
6252

6353
return DocumentSnapshotPlatform(
6454
_firestore,

packages/cloud_firestore/cloud_firestore_platform_interface/test/method_channel_tests/method_channel_transaction_test.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ void main() {
6464
});
6565

6666
group('commands', () {
67-
test('should throw if get is not written', () async {
68-
await transaction.get(mockDocumentReference.path);
69-
expect(() => transaction.commands, throwsAssertionError);
70-
});
71-
7267
test('returns with equal checks', () async {
7368
await transaction.get(mockDocumentReference.path);
7469
transaction.set(mockDocumentReference.path, {'foo': 'bar'});

0 commit comments

Comments
 (0)