Skip to content

LightProbe

Collects ambient light from the phone's light sensor, typically located near the front camera.

Buffers lux readings over each sampling period and reports their statistics as an AmbientLight object.

This probe is only available on Android.

Inheritance

Constructors

LightProbe

LightProbe()

Properties

bufferingStream

Stream get bufferingStream
override

The stream of events to buffer. Implemented by subclasses.

Methods

getMeasurement

Future<Measurement?> getMeasurement()
override

Returns the Measurement for the last sampling window.

Implemented by subclasses.

Can return null if no data is available. Can return an Error if an error occurs.

onInitialize

bool onInitialize()
override

Called by initialize. Returns true if successfully initialized.

If false, the executor stays in ExecutorState.Created. This is a synchronous method and must be light-weight.

onSamplingData

void onSamplingData(
  1. dynamic event
)
override

Called for each event on bufferingStream; buffers it.

onSamplingEnd

void onSamplingEnd()
override

Called when a sampling window ends, before getMeasurement.

onSamplingStart

void onSamplingStart()
override

Called when a sampling window starts, before listening.