LanSyncConfig class
Configuration passed to LanSync.initialize.
All callbacks are optional except onReceive.
Constructors
-
LanSyncConfig({required String appSecret, required String packageName, required String deviceName, required Future<
void> onReceive(List<Map< items), LanSyncTheme? theme, String facilityId = '', String instanceType = '', bool requireScopedPeers = false, Future<String, dynamic> >void> validateIncoming(List<Map< items)?, void onTransferNotification(int count, String fromDevice)?, void onActivity(String action, String description)?, })String, dynamic> > -
const
Properties
- appSecret → String
-
Shared secret embedded in all genuine builds of your app.
Both sides must have the same value — mismatches reject the handshake.
final
- deviceName → String
-
Human-readable name for this device (e.g. logged-in user's name).
final
- facilityId → String
-
Optional: restricts sync to devices in the same facility.
final
- hasCompletePeerScope → bool
-
Whether both values required for scoped peer matching are available.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- instanceType → String
-
Optional: restricts sync to devices using the same instance type.
final
-
Required for LanTransferListener to display the approval sheet over
any screen. Pass the same key used by your MaterialApp.
final
- normalizedFacilityId → String
-
Normalized facility identifier used for peer-scope checks.
no setter
- normalizedInstanceType → String
-
Normalized instance type used for peer-scope checks.
no setter
- onActivity → void Function(String action, String description)?
-
Optional: called for audit-log events (e.g. "items_sent", "items_received").
final
-
onReceive
→ Future<
void> Function(List<Map< items)String, dynamic> > -
Called when the user approves an incoming transfer.
Receives the raw
datamaps from each LanSyncItem sent by the peer.final - onTransferNotification → void Function(int count, String fromDevice)?
-
Optional: called after a transfer is approved so you can show a
local notification. Receives the item count and the sender's device name.
final
- packageName → String
-
Your app's Android package name / iOS bundle identifier.
Used to prevent cross-app connections during handshake.
final
- requireScopedPeers → bool
-
When true, LAN sync fails closed unless both facilityId and
instanceType are present and match on both devices.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scopeId → String
-
Opaque HMAC scope advertised on the LAN instead of exposing facility IDs.
no setter
- theme → LanSyncTheme?
-
Optional host-controlled theme for the package widgets.
final
-
validateIncoming
→ Future<
void> Function(List<Map< items)?String, dynamic> > -
Optional fail-fast validation before an incoming transfer is persisted
or shown for approval. Throw to reject malformed or out-of-realm data.
final
Methods
-
acceptsPeerScope(
{required String peerFacilityId, required String peerInstanceType, required String peerScopeId, required int peerProtocolVersion}) → bool - Returns whether a peer's signed scope matches this configuration.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validatePeerScope(
) → void - Throws when strict peer scoping is enabled without complete scope data.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
normalizeScopePart(
String value) → String - Normalizes a scope component before comparison or signing.