shareFile static method

Future<void> shareFile(
  1. String logs, {
  2. String fileName = 'ispect_all_logs',
  3. String fileType = 'json',
  4. ISpectShareCallback? onShare,
})

Creates a log file and hands it to the platform's share mechanism.

Platform-specific behavior:

  • Native: opens the system share sheet via onShare
  • Web: triggers a browser download (web has no native share sheet)

Parameters:

  • logs: The log content to share
  • fileName: Base name for the file (default: 'ispect_all_logs')
  • onShare: Required on native, ignored on web

Implementation

static Future<void> shareFile(
  String logs, {
  String fileName = 'ispect_all_logs',
  String fileType = 'json',
  ISpectShareCallback? onShare,
}) async {
  final handler = create();
  await handler.createAndShareFile(
    logs,
    fileName: fileName,
    fileType: fileType,
    onShare: onShare,
  );
}