HealthFactory class
Main class for the Plugin.
The plugin supports:
- handling permissions to access health data using the hasPermissions, requestAuthorization, revokePermissions methods.
- reading health data using the getHealthDataFromTypes method.
- writing health data using the writeHealthData method.
- accessing total step counts using the getTotalStepsInInterval method.
- cleaning up dublicate data points via the removeDuplicates method.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getHealthDataFromTypes(
DateTime startTime, DateTime endTime, List< HealthDataType> types) → Future<List< HealthDataPoint> > -
Fetch a list of health data points based on
types
. -
getTotalStepsInInterval(
DateTime startTime, DateTime endTime) → Future< int?> - Get the total numbner of steps within a specific time period. Returns null if not successful.
-
isDataTypeAvailable(
HealthDataType dataType) → bool - Check if a given data type is available on the platform
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestAuthorization(
List< HealthDataType> types, {List<HealthDataAccess> ? permissions}) → Future<bool> - Requests permissions to access data types in Apple Health or Google Fit.
-
toString(
) → String -
A string representation of this object.
inherited
-
writeAudiogram(
List< double> frequencies, List<double> leftEarSensitivities, List<double> rightEarSensitivities, DateTime startTime, DateTime endTime, {Map<String, dynamic> ? metadata}) → Future<bool> - Saves audiogram into Apple Health.
-
writeHealthData(
double value, HealthDataType type, DateTime startTime, DateTime endTime, {HealthDataUnit? unit}) → Future< bool> - Saves health data into Apple Health or Google Fit.
-
writeWorkoutData(
HealthWorkoutActivityType activityType, DateTime start, DateTime end, {int? totalEnergyBurned, HealthDataUnit totalEnergyBurnedUnit = HealthDataUnit.KILOCALORIE, int? totalDistance, HealthDataUnit totalDistanceUnit = HealthDataUnit.METER}) → Future< bool> - Write workout data to Apple Health
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
hasPermissions(
List< HealthDataType> types, {List<HealthDataAccess> ? permissions}) → Future<bool?> - Determines if the data types have been granted with the specified access rights.
-
removeDuplicates(
List< HealthDataPoint> points) → List<HealthDataPoint> - Given an array of HealthDataPoints, this method will return the array without any duplicates.
-
revokePermissions(
) → Future< void> - Revoke permissions obtained earlier.