onDisplayChange property

Stream<List<MediaDisplayDetails>> get onDisplayChange

Returns a Stream of the MediaDisplayDetails changes.

Implementation

Stream<List<MediaDisplayDetails>> get onDisplayChange {
  if (_displaysController == null) {
    _displaysController = StreamController.broadcast();

    if (PlatformUtils.isDesktop && !PlatformUtils.isWeb) {
      Future(() async {
        _displaysController?.add(
          (await (await _mediaManager)?.enumerateDisplays() ?? [])
              .where((e) => e.deviceId().isNotEmpty)
              .toList(),
        );
      });
    }
  }

  return _displaysController!.stream;
}