onFullscreenChange property

Stream<bool> get onFullscreenChange

Returns a stream broadcasting fullscreen changes.

Implementation

Stream<bool> get onFullscreenChange {
  if (isWeb) {
    return WebUtils.onFullscreenChange;
  } else if (isDesktop) {
    StreamController<bool>? controller;

    var windowListener = _WindowListener(
      onEnterFullscreen: () => controller!.add(true),
      onLeaveFullscreen: () => controller!.add(false),
    );

    controller = StreamController<bool>(
      onListen: () => WindowManager.instance.addListener(windowListener),
      onCancel: () => WindowManager.instance.removeListener(windowListener),
    );

    return controller.stream;
  }

  // TODO: Implement for [isMobile] using the
  //       [SystemChrome.setSystemUIChangeCallback].
  return const Stream.empty();
}