Shares text, links and files through the system sheet or straight to one app, and receives shares into the app. All 6 platforms. UShare.text("Hello")
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
received
→ Stream<
UReceivedShare> -
Shares received while the app runs ("Share to MyApp", "Open with MyApp"). Needs
dart run u:app share-target.no setter
Static Methods
-
bytes(
Uint8List bytes, {required String name, String? mimeType, String? text, String? subject, Rect? origin}) → Future< UShareResult> -
Shares bytes as a file called
name; no temp file handling needed.UShare.bytes(pdfBytes, name: "invoice.pdf") -
True when
targetis installed and can take a direct share.if (await UShare.canShareTo(UShareTarget.whatsapp)) … -
file(
String path, {String? text, String? subject, String? name, String? mimeType, Rect? origin}) → Future< UShareResult> -
Shares one file from disk (Linux: shows it in the file manager).
UShare.file("/path/report.pdf") -
files(
List< String> paths, {String? text, String? subject, String? title, Rect? origin}) → Future<UShareResult> -
Shares several files from disk.
UShare.files([a, b]) -
initialReceived(
) → Future< UReceivedShare?> -
What was shared into the app when that share opened it, or null. Needs
dart run u:app share-target.final share = await UShare.initialReceived(); -
link(
String url, {String? message, String? subject, String? title, Rect? origin}) → Future< UShareResult> -
Shares a link with a rich preview on iOS/macOS;
messagegoes before it.UShare.link("https://x.com/p/1", message: "New product") -
onReceive(
) → Future< StreamSubscription< UReceivedShare> > -
Calls
onSharefor the launch share and every later one; web needs a PWA with share_target in the manifest.UShare.onReceive((s) => importFiles(s.files)) -
originOf(
BuildContext context) → Rect? -
Screen rect of the widget that owns
context; pass it as origin so the iPad/macOS share popover points at your button.UShare.originOf(context) -
Shares any mix of text, link and files in one sheet.
UShare.share(text: "Invoice", files: [UShareFile.path(p)]) -
text(
String text, {String? subject, String? title, Rect? origin}) → Future< UShareResult> -
Shares text;
subjectis used by email apps; on iPad/macOS passorigin. Linux copies to the clipboard.UShare.text("Check this out", origin: UShare.originOf(context)) -
to(
UShareTarget target, {String? text, List< UShareFile> files = const <UShareFile>[]}) → Future<UShareResult> -
Shares straight to WhatsApp, Telegram, Eitaa, Rubika… without the sheet; falls back to the sheet (Android best, iOS text only).
UShare.to(UShareTarget.telegram, text: "Hi") -
widgetImage(
UWidgetToImageController controller, {String name = "image.png", String? text, String? subject, Rect? origin}) → Future< UShareResult?> -
Takes a picture of a UWidgetToImage and shares it as PNG (e.g. a receipt).
UShare.widgetImage(controller, name: "receipt.png")