startShare method

  1. @override
Future<void> startShare({
  1. required String notificationTitle,
  2. String? notificationText,
})
override

Takes the hold a consent-driven capture runs inside, showing an ongoing notification titled notificationTitle with notificationText under it.

It belongs between the system's consent and the capture start: the hold is granted only once consent is, and the capture only succeeds while the hold is up. A platform that asks for no hold answers here anyway, with whether it would serve a capture right now, and has no role for the notification arguments.

Throws XScreenSourcesException with permission_denied when the platform refuses the hold for want of consent, and service_start_failed when it refuses for anything else or when a later startShare or a stopShare settles this one before the hold is up. An empty notificationTitle throws ArgumentError without reaching the platform.

Implementation

@override
Future<void> startShare({
  required String notificationTitle,
  String? notificationText,
}) async {
  _requireSupported();
  startShareCalls.add((
    notificationTitle: notificationTitle,
    notificationText: notificationText,
  ));
  final err = startShareError;
  if (err != null) throw err;
}