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
4 changes: 4 additions & 0 deletions packages/cloud_firestore/cloud_firestore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ Along with the below changes, the plugin has undergone a quality of life update

**`CollectionReference`**:
- **BREAKING**: Getting a collection parent document via `parent()` has been changed to a getter `parent`.
- **BREAKING**: Getting the collection `path` now always returns the `path` without leading and trailing slashes.
- **DEPRECATED**: Calling `document()` is deprecated in favor of `doc()`.
- **FIX**: Equality checking of `CollectionReference` now does not depend on the original path used to create the `CollectionReference`.

**`Query`**:
- **BREAKING**: The internal query logic has been overhauled to better assert invalid queries locally.
Expand All @@ -38,9 +40,11 @@ Along with the below changes, the plugin has undergone a quality of life update
- **BREAKING**: `setData`/`set` has been updated to accept an instance of `SetOptions` (see below, supports `mergeFields`).
- **BREAKING**: `get()` has been updated to accept an instance of `GetOptions` (see below).
- **BREAKING**: Getting a document parent collection via `parent()` has been changed to a getter `parent`.
- **BREAKING**: Getting the document `path` now always returns the `path` without leading and trailing slashes.
- **DEPRECATED**: `documentID` has been deprecated in favor of `id`.
- **DEPRECATED**: `setData()` has been deprecated in favor of `set()`.
- **DEPRECATED**: `updateData()` has been deprecated in favor of `update()`.
- **FIX**: Equality checking of `DocumentReference` now does not depend on the original path used to create the `DocumentReference`.

**`DocumentChange`**:
- **DEPRECATED**: Calling `document()` is deprecated in favor of `doc()`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
/// to reduce code repetition and improve testability.
class Pointer {
/// Create instance of [Pointer]
Pointer(this.path)
Pointer(String path)
: assert(path != null),
components =
path.split('/').where((element) => element.isNotEmpty).toList();

/// The Firestore path the [Pointer] was initialized with.
final String path;
/// The Firestore normalized path of the [Pointer].
String get path {
return components.join('/');
}

/// Pointer components of the path.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,12 @@ void main() {
expect(Pointer('foo') == Pointer('foo'), true);
expect(Pointer('foo') == Pointer('foo/bar'), false);
});

test('Pointer equality with un-normalized paths', () {
expect(Pointer('foo') == Pointer('/foo'), true);
expect(Pointer('foo') == Pointer('/foo/bar'), false);
expect(Pointer('foo') == Pointer('foo/'), true);
expect(Pointer('foo') == Pointer('foo/bar/'), false);
});
});
}