@@ -152,7 +152,7 @@ class HealthKitReporter {
152
152
/// Provide the [predicate] to set the date interval.
153
153
///
154
154
static StreamSubscription <dynamic > heartbeatSeriesQuery (Predicate predicate,
155
- {Function (HeartbeatSerie ) onUpdate}) {
155
+ {required Function (HeartbeatSerie ) onUpdate}) {
156
156
final arguments = predicate.map;
157
157
return _heartbeatSeriesQueryChannel
158
158
.receiveBroadcastStream (arguments)
@@ -169,7 +169,7 @@ class HealthKitReporter {
169
169
/// Provide the [predicate] to set the date interval.
170
170
///
171
171
static StreamSubscription <dynamic > workoutRouteQuery (Predicate predicate,
172
- {Function (WorkoutRoute ) onUpdate}) {
172
+ {required Function (WorkoutRoute ) onUpdate}) {
173
173
final arguments = predicate.map;
174
174
return _workoutRouteQueryChannel
175
175
.receiveBroadcastStream (arguments)
@@ -188,7 +188,7 @@ class HealthKitReporter {
188
188
///
189
189
static StreamSubscription <dynamic > observerQuery (
190
190
String identifier, Predicate predicate,
191
- {Function (String ) onUpdate}) {
191
+ {required Function (String ) onUpdate}) {
192
192
final arguments = < String , dynamic > {
193
193
'identifier' : identifier,
194
194
};
@@ -211,7 +211,7 @@ class HealthKitReporter {
211
211
///
212
212
static StreamSubscription <dynamic > anchoredObjectQuery (
213
213
String identifier, Predicate predicate,
214
- {Function (List <Sample >, List <DeletedObject >) onUpdate}) {
214
+ {required Function (List <Sample >, List <DeletedObject >) onUpdate}) {
215
215
final arguments = < String , dynamic > {
216
216
'identifier' : identifier,
217
217
};
@@ -225,7 +225,9 @@ class HealthKitReporter {
225
225
for (final String element in samplesList) {
226
226
final json = jsonDecode (element);
227
227
final sample = Sample .factory (json);
228
- samples.add (sample);
228
+ if (sample != null ) {
229
+ samples.add (sample);
230
+ }
229
231
}
230
232
final deletedObjectsList = List .from (map['deletedObjects' ]);
231
233
final deletedObjects = < DeletedObject > [];
@@ -247,7 +249,7 @@ class HealthKitReporter {
247
249
///
248
250
static StreamSubscription <dynamic > queryActivitySummaryUpdates (
249
251
Predicate predicate,
250
- {Function (List <ActivitySummary >) onUpdate}) {
252
+ {required Function (List <ActivitySummary >) onUpdate}) {
251
253
final arguments = predicate.map;
252
254
return _queryActivitySummaryChannel
253
255
.receiveBroadcastStream (arguments)
@@ -281,7 +283,7 @@ class HealthKitReporter {
281
283
DateTime enumerateFrom,
282
284
DateTime enumerateTo,
283
285
DateComponents intervalComponents,
284
- {Function (Statistics ) onUpdate}) {
286
+ {required Function (Statistics ) onUpdate}) {
285
287
final arguments = {
286
288
'identifier' : type.identifier,
287
289
'unit' : unit,
@@ -446,7 +448,9 @@ class HealthKitReporter {
446
448
for (final String element in list) {
447
449
final json = jsonDecode (element);
448
450
final sample = Sample .factory (json);
449
- samples.add (sample);
451
+ if (sample != null ) {
452
+ samples.add (sample);
453
+ }
450
454
}
451
455
return samples;
452
456
}
@@ -559,7 +563,7 @@ class HealthKitReporter {
559
563
///
560
564
static Future <List <Correlation >> correlationQuery (
561
565
String identifier, Predicate predicate,
562
- {Map <String , Predicate > typePredicates}) async {
566
+ {Map <String , Predicate >? typePredicates}) async {
563
567
final arguments = {
564
568
'identifier' : identifier,
565
569
'typePredicates' : typePredicates,
@@ -598,7 +602,7 @@ class HealthKitReporter {
598
602
/// [device] is optional.
599
603
///
600
604
static Future <bool > addCategory (List <Category > categories, Workout workout,
601
- {Device device}) async {
605
+ {Device ? device}) async {
602
606
final arguments = {
603
607
'categories' : categories.map ((e) => e.map).toList (),
604
608
'workout' : workout.map,
@@ -611,7 +615,7 @@ class HealthKitReporter {
611
615
/// [device] is optional.
612
616
///
613
617
static Future <bool > addQuantity (List <Quantity > quantities, Workout workout,
614
- {Device device}) async {
618
+ {Device ? device}) async {
615
619
final arguments = {
616
620
'quantities' : quantities.map ((e) => e.map).toList (),
617
621
'workout' : workout.map,
0 commit comments