Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,11 @@ class MethodChannelTransaction extends TransactionPlatform {
FirebaseFirestorePlatform.instanceFor(app: Firebase.app(appName));
}

int _documentGetCount = 0;

List<Map<String, dynamic>> _commands = [];

/// Returns all transaction commands for the current instance.
///
/// All get operations must be written, otherwise an [AssertionError] will be thrown
@override
List<Map<String, dynamic>> get commands {
if (_documentGetCount > 0) {
assert(_documentGetCount <= _commands.length,
"All transaction get operations must also be written.");
}

return _commands;
}

Expand All @@ -58,7 +49,6 @@ class MethodChannelTransaction extends TransactionPlatform {
'transactionId': _transactionId,
'reference': _firestore.doc(documentPath),
});
_documentGetCount++;

return DocumentSnapshotPlatform(
_firestore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'});
Expand Down