From 9d71ca106dc0914179fabe3de2934e475327a9c0 Mon Sep 17 00:00:00 2001 From: ehesp Date: Thu, 9 Jul 2020 15:56:42 +0100 Subject: [PATCH 1/2] fix(cloud_firestore): remove get-write validation --- .../src/method_channel/method_channel_transaction.dart | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/cloud_firestore/cloud_firestore_platform_interface/lib/src/method_channel/method_channel_transaction.dart b/packages/cloud_firestore/cloud_firestore_platform_interface/lib/src/method_channel/method_channel_transaction.dart index ec6391a8e52b..f031a0da68e7 100644 --- a/packages/cloud_firestore/cloud_firestore_platform_interface/lib/src/method_channel/method_channel_transaction.dart +++ b/packages/cloud_firestore/cloud_firestore_platform_interface/lib/src/method_channel/method_channel_transaction.dart @@ -26,20 +26,11 @@ class MethodChannelTransaction extends TransactionPlatform { FirebaseFirestorePlatform.instanceFor(app: Firebase.app(appName)); } - int _documentGetCount = 0; - List> _commands = []; /// Returns all transaction commands for the current instance. - /// - /// All get operations must be written, otherwise an [AssertionError] will be thrown @override List> get commands { - if (_documentGetCount > 0) { - assert(_documentGetCount <= _commands.length, - "All transaction get operations must also be written."); - } - return _commands; } @@ -58,7 +49,6 @@ class MethodChannelTransaction extends TransactionPlatform { 'transactionId': _transactionId, 'reference': _firestore.doc(documentPath), }); - _documentGetCount++; return DocumentSnapshotPlatform( _firestore, From 354d64d058c64ea70d6b039500024b97bdf98449 Mon Sep 17 00:00:00 2001 From: ehesp Date: Thu, 9 Jul 2020 16:09:40 +0100 Subject: [PATCH 2/2] remove invalid test --- .../method_channel_transaction_test.dart | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/cloud_firestore/cloud_firestore_platform_interface/test/method_channel_tests/method_channel_transaction_test.dart b/packages/cloud_firestore/cloud_firestore_platform_interface/test/method_channel_tests/method_channel_transaction_test.dart index 5062d205f495..71a9d54c665c 100644 --- a/packages/cloud_firestore/cloud_firestore_platform_interface/test/method_channel_tests/method_channel_transaction_test.dart +++ b/packages/cloud_firestore/cloud_firestore_platform_interface/test/method_channel_tests/method_channel_transaction_test.dart @@ -64,11 +64,6 @@ void main() { }); group('commands', () { - test('should throw if get is not written', () async { - await transaction.get(mockDocumentReference.path); - expect(() => transaction.commands, throwsAssertionError); - }); - test('returns with equal checks', () async { await transaction.get(mockDocumentReference.path); transaction.set(mockDocumentReference.path, {'foo': 'bar'});