What a screen share needs from the platform, which captureMode splits in two: the displays and windows a picker can offer, each with a rendered thumbnail, taken as one snapshot — or the bracket a consent-driven capture runs inside.
final backend = XScreenSourcesBackend.instance;
if (await backend.hasPermission()) {
final sources = await backend.list(
allowedDisplayIds: displayIds,
allowedWindowIds: windowIds,
);
}
The caller passes the ids it is willing to capture and presents exactly what comes back. list never prompts — permission is hasPermission and requestPermission, which the caller drives before it opens a picker.
Properties
- captureMode → XScreenCaptureMode?
-
How this platform family shares a screen, or
nullwhere it shares none at all. Independent of supported: a family names its mode even where no capture ships for it.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supported → bool
-
Whether this platform family serves these calls. Elsewhere every method
throws XScreenSourcesException with code
unsupported, before it looks at its arguments — and so does every call the family's captureMode has no role for: list and the permission pair off XScreenCaptureMode.pickerDriven, startShare and stopShare off XScreenCaptureMode.consentDriven.no setter
Methods
-
available(
) → Future< bool> -
Whether this host can serve its captureMode — the platform family and
the OS version, plus whatever else the platform makes a capture depend
on: on iOS this is ReplayKit's own answer, false while the app is not in
front, a mirrored display is attached, or another recorder holds the
screen, and on Android it is false unless the app's pubspec sets
ux: enable_media_projection: true. -
hasPermission(
) → Future< bool> - Whether screen recording is granted. Never prompts.
-
list(
{required Set< String> allowedDisplayIds, required Set<String> allowedWindowIds, int thumbnailWidth = 320, int thumbnailHeight = 180}) → Future<List< XScreenSource> > -
The allowed sources present right now, each with a
thumbnailWidth×thumbnailHeightaspect-fit PNG. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestPermission(
) → Future< bool> - Asks for screen-recording access, returning the state the call leaves behind.
-
Takes the hold a consent-driven capture runs inside, showing an ongoing
notification titled
notificationTitlewithnotificationTextunder it. - Drops the hold startShare took. Dropping one nobody holds succeeds.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance ↔ XScreenSourcesBackend
-
The process-wide backend. Swap to inject a fake before any picker code
runs.
getter/setter pair