BackgroundCaptureClient class
Client for BackgroundCaptureService.
Captures the screen content behind palette windows and streams it as a Flutter texture for use with liquid glass effects.
This client uses the self channel (floating_palette/self) which is available in each palette's Flutter engine, ensuring the texture is registered on the correct engine.
Usage:
final client = BackgroundCaptureClient();
// Check permission first
final permission = await client.checkPermission();
if (permission != BackgroundCapturePermission.granted) {
await client.requestPermission();
return;
}
// Start capture
final textureId = await client.startCapture(
config: BackgroundCaptureConfig(frameRate: 30, pixelRatio: 0.5),
);
// Use texture in widget
Texture(textureId: textureId)
// Stop when done
await client.stopCapture();
Constructors
Properties
-
events
→ Stream<
BackgroundCaptureEvent> -
Stream of capture events.
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
Methods
-
checkPermission(
) → Future< BackgroundCapturePermission> - Check current screen recording permission status.
-
dispose(
) → void -
getTextureId(
) → Future< int?> - Get the current texture ID for this palette. Returns null if no capture is active.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestPermission(
) → Future< void> - Request screen recording permission. This opens System Preferences to the Screen Recording section.
-
startCapture(
{BackgroundCaptureConfig config = const BackgroundCaptureConfig()}) → Future< int?> - Start capturing the background behind this palette window.
-
stopCapture(
) → Future< void> - Stop capturing and release resources.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited