Skip to content

AppLifecycleTrigger

A trigger that triggers when the life cycle of an app changes.

The state changes that triggers are specified in states. If not specified (default) this trigger will trigger on all AppLifecycleState changes.

Typically used to make sure to collect measures when the app life cycle is changing, e.g., moved to the background or foreground. Some measures - like audio, bluetooth, and health - can only be collected when the app is in the foreground.

Inheritance
Annotations

Constructors

AppLifecycleTrigger.fromJson

AppLifecycleTrigger.fromJson(
  1. Map<String, dynamic> json
)

AppLifecycleTrigger

AppLifecycleTrigger([
  1. Set<AppLifecycleState>? states
])

Creates an AppLifecycleTrigger that triggers whenever the app state changes. If states is not specified, it will trigger on all state change events.

Properties

fromJsonFunction

Function get fromJsonFunction
override

The function which can convert a JSON string to an object of this type.

states

Set<AppLifecycleState> states
getter/setter pair

The app life cycle states that fire this trigger.

Methods

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.