BackupRestorePanel class

UI for the save-backup flow StorageService.exportAll()/importAll() and save_integrity.dart's HMAC sign/verify already support at the core layer but have no widget to drive them from.

Same "seam" convention as CloudSaveProvider/PurchaseSeam: this panel owns none of the actual file/QR/share mechanism. onExport receives the already-signed JSON string and is responsible for getting it out of the app (write to a file, encode as a QR, share sheet...); onImport is responsible for getting a JSON string back in (file picker, QR scan...) and returns null if the caller cancelled — the panel treats that as a silent no-op, not an error.

secret is the HMAC key from signExport/verifyAndStrip — supplied by the consuming app for the same reason save_integrity.dart's own doc gives: a secret baked into this package would be shared (and leaked) by every game built on it.

Import overwrites the entire local save (StorageService.importAll's own behavior), so it's gated behind a showConfirmDialog "are you sure?" step first — export is non-destructive and has no such gate.

Inheritance

Constructors

BackupRestorePanel({Key? key, required String secret, required Future<void> onExport(String signedJson), required Future<String?> onImport(), String title = 'Backup & Restore', String exportLabel = 'Export save', String importLabel = 'Restore save', String confirmImportTitle = 'Restore save?', String confirmImportMessage = 'This replaces all current progress with the restored save. This ' 'cannot be undone.', String exportSuccessMessage = 'Save exported.', String importSuccessMessage = 'Save restored.', String workingAnnouncement = 'Working…', @visibleForTesting StorageService? storage})
const

Properties

confirmImportMessage → String
final
confirmImportTitle → String
final
exportLabel → String
final
exportSuccessMessage → String
final
hashCode → int
The hash code for this object.
no setterinherited
importLabel → String
final
importSuccessMessage → String
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onExport → Future<void> Function(String signedJson)
Receives the signed JSON string to hand off to the actual file/QR/share mechanism.
final
onImport → Future<String?> Function()
Returns the JSON string to verify and import, or null if the caller cancelled (e.g. closed the file picker) — treated as a silent no-op.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
secret → String
final
storage → StorageService?
Overrides the ambient StorageService.to singleton — test-only seam.
final
title → String
final
workingAnnouncement → String
ENH-78: screen-reader-only announcement shown while busy — same "caller owns copy" convention as the other String params above.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<BackupRestorePanel>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

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