watchKioskMode function

Stream<KioskMode> watchKioskMode({
  1. Duration androidQueryPeriod = const Duration(seconds: 5),
})

Returns the stream with KioskMode.

The initial value of the stream will always be from getKioskMode.

Since Android doesn't allow subscribing to lock task mode changes, a mode is queried every time with a period of androidQueryPeriod.

Implementation

Stream<KioskMode> watchKioskMode({
  Duration androidQueryPeriod = const Duration(seconds: 5),
}) =>
    Stream.fromFuture(getKioskMode())
        .merge(_getKioskModeStream(androidQueryPeriod));