Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: More asserts to argumentError
  • Loading branch information
MichaelVerdon committed Apr 24, 2025
commit 737fca594fa944a5c781c7eee81c6abaecb141e9
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ class _JsonCollectionReference extends _JsonQuery
@override
DocumentReference<Map<String, dynamic>> doc([String? path]) {
if (path != null) {
assert(path.isNotEmpty, 'a document path must be a non-empty string');
assert(!path.contains('//'), 'a document path must not contain "//"');
assert(path != '/', 'a document path must point to a valid document');
if (path.isEmpty) {
throw ArgumentError('A document path must be a non-empty string');
} else if (path.contains('//')) {
throw ArgumentError('A document path must not contain "//"');
} else if (path == '/') {
throw ArgumentError('A document path must point to a valid document');
}
}

return _JsonDocumentReference(firestore, _delegate.doc(path));
Expand Down
Loading