Health import

Generated reference for ovok_flutter: health import.

  • Stable unknown
  • Release candidate since 0.1.0-rc.6
  • Development since 0.1.0-dev.32+1028d01

HealthImportAccessStatus

enum HealthImportAccessStatus

Health-source access state for one data type.

Values

HealthImportAccessStatus.authorized

static const HealthImportAccessStatus authorized

The app can read this data type.

HealthImportAccessStatus.shouldRequest

static const HealthImportAccessStatus shouldRequest

The app can request access to this data type.

HealthImportAccessStatus.refused

static const HealthImportAccessStatus refused

The user did not grant access to this data type.

HealthImportAccessStatus.unsupported

static const HealthImportAccessStatus unsupported

The active health source does not provide this data type.

HealthImportAdapter

abstract interface class HealthImportAdapter<TType>

Reads and requests access to one health data type.

Methods

HealthImportAdapter.getStatus

Future<HealthImportAccessStatus> getStatus(TType type)

Returns the current access status of type.

ParameterTypeKindDefault
typeTTypepositional

Returns Future<HealthImportAccessStatus>.

HealthImportAdapter.request

Future<void> request(List<TType> types, {required bool background})

Requests access to types, optionally including background reading.

ParameterTypeKindDefault
typesList<TType>positional
backgroundboolrequired named

Returns Future<void>.

HealthImportController

class HealthImportController<TType> extends ChangeNotifier

Tracks health import access and requests permission when import is enabled.

Constructors

HealthImportController.new

HealthImportController<TType>({
  required Iterable<TType> types,
  required HealthImportAdapter<TType> adapter,
  bool background = false,
})

Creates a controller for types using adapter.

ParameterTypeKindDefault
typesIterable<TType>required named
adapterHealthImportAdapter<TType>required named
backgroundboolnamedfalse

Properties

HealthImportController.types

final List<TType> types

Data types managed by this controller.

HealthImportController.background

final bool background

Whether the health source should allow reading data in the background.

HealthImportController.enabled

bool get enabled

Whether health import is switched on.

HealthImportController.statusByType

Map<TType, HealthImportAccessStatus> get statusByType

Access status for each type whose status was read successfully.

HealthImportController.notShared

List<TType> get notShared

Data types that the user has not shared.

HealthImportController.error

Object? get error

Error from the last status check or access request.

Methods

HealthImportController.refresh

Future<void> refresh()

Refreshes access status for all configured types.

Returns Future<void>.

HealthImportController.setEnabled

Future<void> setEnabled(bool enabled)

Requests access before switching import on; switches off without a request.

ParameterTypeKindDefault
enabledboolpositional

Returns Future<void>.

Last updated on

On this page