|
3 | 3 | // BSD-style license that can be found in the LICENSE file.
|
4 | 4 |
|
5 | 5 | import 'package:cloud_firestore_platform_interface/cloud_firestore_platform_interface.dart';
|
| 6 | +import 'package:plugin_platform_interface/plugin_platform_interface.dart'; |
6 | 7 |
|
7 |
| -/// [VectorQuerySnapshotPlatform] represents a response to an [VectorQueryPlatform] request. |
8 |
| -class VectorQuerySnapshotPlatform extends QuerySnapshotPlatform { |
| 8 | +/// A interface that contains zero or more [DocumentSnapshotPlatform] objects |
| 9 | +/// representing the results of a query. |
| 10 | +/// |
| 11 | +/// The documents can be accessed as a list by calling [docs()] and the number of documents |
| 12 | +/// can be determined by calling [size()]. |
| 13 | +class VectorQuerySnapshotPlatform extends PlatformInterface { |
| 14 | + /// Create a [VectorQuerySnapshotPlatform] |
9 | 15 | VectorQuerySnapshotPlatform(
|
10 |
| - super.docs, |
11 |
| - super.docChanges, |
12 |
| - super.metadata, |
13 |
| - ) : super(); |
| 16 | + this.docs, |
| 17 | + this.docChanges, |
| 18 | + this.metadata, |
| 19 | + ) : super(token: _token); |
| 20 | + |
| 21 | + static final Object _token = Object(); |
| 22 | + |
| 23 | + /// Throws an [AssertionError] if [instance] does not extend |
| 24 | + /// [VectorQuerySnapshotPlatform]. |
| 25 | + /// |
| 26 | + /// This is used by the app-facing [QuerySnapshot] to ensure that |
| 27 | + /// the object in which it's going to delegate calls has been |
| 28 | + /// constructed properly. |
| 29 | + static void verify(VectorQuerySnapshotPlatform instance) { |
| 30 | + PlatformInterface.verify(instance, _token); |
| 31 | + } |
| 32 | + |
| 33 | + /// Gets a list of all the documents included in this [VectorQuerySnapshotPlatform] |
| 34 | + final List<DocumentSnapshotPlatform> docs; |
| 35 | + |
| 36 | + /// An array of the documents that changed since the last snapshot. If this |
| 37 | + /// is the first snapshot, all documents will be in the list as Added changes. |
| 38 | + final List<DocumentChangePlatform> docChanges; |
| 39 | + |
| 40 | + /// Metadata for the document |
| 41 | + final SnapshotMetadataPlatform metadata; |
| 42 | + |
| 43 | + /// The number of documents in this [VectorQuerySnapshotPlatform]. |
| 44 | + int get size => docs.length; |
14 | 45 | }
|
0 commit comments