onReceive static method

Future<StreamSubscription<UReceivedShare>> onReceive(
  1. void onShare(
    1. UReceivedShare share
    )
)

Calls onShare for the launch share and every later one; web needs a PWA with share_target in the manifest. UShare.onReceive((s) => importFiles(s.files))

Implementation

static Future<StreamSubscription<UReceivedShare>> onReceive(void Function(UReceivedShare share) onShare) async {
  final StreamSubscription<UReceivedShare> subscription = received.listen(onShare);
  final UReceivedShare? first = await initialReceived();
  if (first != null && !first.isEmpty) onShare(first);
  return subscription;
}