ShareReporter class

A reporter that hands a JSON attachment to the platform share sheet.

send opens the same sharing UI as share, including for automatic reports. Browsers can download the attachment when native sharing is unavailable. Both methods return false on dismissal, failure, or an outstanding native ShareReporter handoff in this isolate. File sharing is unavailable on Linux and older Windows versions. A platform handoff with unavailable feedback counts as success.

On native platforms a successful handoff leaves the attachment in the application's temporary directory for the recipient. The OS may reclaim these files. Failed and dismissed attempts remove their temporary files.

Inheritance

Constructors

ShareReporter({String subjectPrefix = 'Bug Report', String textBuilder(ReportEvent event)?, String fileNameBuilder(ReportEvent event)?})
Creates a share reporter with optional customization hooks for text and filenames.
const

Properties

fileNameBuilder → String Function(ReportEvent event)?
Optional file name builder. Read ReportEvent.toMap for sanitized fields. Without a nonblank override, native handoffs append a unique suffix to the standard report name. A distinct Reporter.defaultFileName override keeps its sanitized name.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
subjectPrefix → String
Subject prefix displayed in the share sheet (email clients, etc.).
finalinherited
textBuilder → String Function(ReportEvent event)?
Optional share body builder. Read ReportEvent.toMap for sanitized fields. The default body summarizes the fields retained in that payload.
finalinherited

Methods

defaultFileName(ReportEvent event) → String
A JSON file name derived from the ID and timestamp retained in the payload.
inherited
generateFile(ReportEvent event, {String? fileName, Directory? directory}) → Future<File>
Writes the retained JSON to directory or the app's temporary directory.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(ReportEvent event) → Future<bool>
Sends a ReportEvent to the remote/system of choice.
inherited
share(ReportEvent event) → Future<bool>
User-initiated sharing of a ReportEvent (e.g., via share sheet).
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited