15
15
16
16
part of amplify_interface;
17
17
18
- /// Interface for DataStore category. This expose all the APIs that
19
- /// are supported by this category's plugins. This class will accept plugins to
20
- /// be registered and configured and then subsequent API calls will be forwarded
21
- /// to those plugins.
18
+ /// {@template amplify_flutter.amplify_datastore_category}
19
+ /// Interface for the DataStore category.
20
+ ///
21
+ /// This exposes all the APIs that are supported by this category's plugins.
22
+ /// This class will accept plugins to be registered and configured and then
23
+ /// subsequent API calls will be forwarded to those plugins.
24
+ /// {@endtemplate}
22
25
class DataStoreCategory {
23
- /// Default constant constructor
26
+ /// {@macro amplify_flutter.amplify_datastore_category}
24
27
const DataStoreCategory ();
25
28
26
29
/// Added DataStore plugins.
@@ -66,7 +69,9 @@ class DataStoreCategory {
66
69
}
67
70
68
71
/// Query the DataStore to find all items of the specified [modelType] that satisfy the specified
69
- /// query predicate [where] . Returned items are paginated by [pagination] and sorted by [sortBy] .
72
+ /// query predicate [where] .
73
+ ///
74
+ /// Returned items are paginated by [pagination] and sorted by [sortBy] .
70
75
Future <List <T >> query <T extends Model >(ModelType <T > modelType,
71
76
{QueryPredicate ? where,
72
77
QueryPagination ? pagination,
@@ -99,17 +104,25 @@ class DataStoreCategory {
99
104
: throw _pluginNotAddedException ('DataStore' );
100
105
}
101
106
102
- /// Stops the underlying DataStore, resetting the plugin to the initialized state, and deletes all data
103
- /// from the local device. Remotely synced data can be re-synced back when starting DataStore using
104
- /// [start] . local-only data will be lost permanently.
107
+ /// Stops the underlying DataStore's synchronization with a remote system, if DataStore is configured to
108
+ /// support remote synchronization, resetting the plugin to the initialized state, and deletes all data
109
+ /// from the local device.
110
+ ///
111
+ /// Any items pending synchronization in the outbound queue will be lost. Remotely synced data can be re-synced
112
+ /// back when starting DataStore using [start] . **Local-only data will be lost permanently.**
113
+ ///
114
+ /// Synchronization processes will be restarted on the next interaction with the DataStore, or can be
115
+ /// restarted manually by calling [start] .
105
116
Future <void > clear () {
106
117
return plugins.length == 1
107
118
? plugins[0 ].clear ()
108
119
: throw _pluginNotAddedException ('DataStore' );
109
120
}
110
121
111
122
/// Starts the DataStore's synchronization with a remote system, if DataStore is configured to support
112
- /// remote synchronization. This only needs to be called if you wish to start the synchronization eagerly.
123
+ /// remote synchronization.
124
+ ///
125
+ /// This only needs to be called if you wish to start the synchronization eagerly.
113
126
/// If you don't call start(), the synchronization will start automatically, prior to executing any other
114
127
/// operations (query, save, delete, update).
115
128
Future <void > start () {
@@ -120,16 +133,19 @@ class DataStoreCategory {
120
133
121
134
/// Stops the underlying DataStore's synchronization with a remote system, if DataStore is configured to
122
135
/// support remote synchronization.
136
+ ///
137
+ /// Synchronization processes will be restarted on the next interaction with the DataStore, or can be
138
+ /// restarted manually by calling [start] .
123
139
Future <void > stop () {
124
140
return plugins.length == 1
125
141
? plugins[0 ].stop ()
126
142
: throw _pluginNotAddedException ('DataStore' );
127
143
}
128
144
129
- /// Observe the result set of a given Query
145
+ /// Observe the result set of a given Query.
130
146
///
131
147
/// Emits an initial [QuerySnapshot] with data from the local store, as well as
132
- /// subsequent events with data synced over the network
148
+ /// subsequent events with data synced over the network.
133
149
Stream <QuerySnapshot <T >> observeQuery <T extends Model >(
134
150
ModelType <T > modelType, {
135
151
QueryPredicate ? where,
0 commit comments