Skip to content

Commit

Permalink
Map return for deleteObjects
Browse files Browse the repository at this point in the history
  • Loading branch information
kvs-coder committed May 28, 2021
1 parent 6cbbce4 commit 0db351f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ios/Classes/SwiftHealthKitReporterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ extension SwiftHealthKitReporterPlugin {
reporter.writer.deleteObjects(
of: type,
predicate: predicate
) { (success, id, error) in
) { (success, count, error) in
guard error == nil else {
result(
FlutterError(
Expand All @@ -1368,7 +1368,7 @@ extension SwiftHealthKitReporterPlugin {
}
let resultDictionary: [String: Any] = [
"status": success,
"id": id
"count": count
]
result(resultDictionary)
}
Expand Down
7 changes: 5 additions & 2 deletions lib/health_kit_reporter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -633,13 +633,16 @@ class HealthKitReporter {

/// Deletes all objects related to [identifier] with [predicate].
///
static Future<dynamic> deleteObjects(
static Future<Map<String, dynamic>> deleteObjects(
String identifier, Predicate predicate) async {
final arguments = <String, dynamic>{
'identifier': identifier,
};
arguments.addAll(predicate.map);
return await _methodChannel.invokeMethod('deleteObjects', arguments);
final result =
await _methodChannel.invokeMethod('deleteObjects', arguments);
final Map<String, dynamic> map = jsonDecode(result);
return map;
}

/// Saves [Sample] in [HealthKit].
Expand Down

0 comments on commit 0db351f

Please sign in to comment.