MobileLifecycleCoordinator class

Coordinates node resource utilization, background connection scaling, and persistent cache safety in mobile application environments.

Constructors

MobileLifecycleCoordinator({required MobileLifecycleAdapter adapter, Reprovider? reprovider, NetworkManager? networkManager, BlockStore? blockStore, Future<void> onDetached()?, bool autoScaleSwarm = true, int maxForegroundConnections = 50, int maxLowPowerConnections = 15, int maxBackgroundConnections = 2, bool pauseReproviderOnBackground = true, bool flushBlockStoreOnBackground = true, bool requestBackgroundExtensionOnPause = true, Duration backgroundExtensionDuration = const Duration(seconds: 30)})
Creates a new MobileLifecycleCoordinator.

Properties

adapter → MobileLifecycleAdapter
The platform lifecycle adapter providing event streams.
final
autoScaleSwarm → bool
Whether to automatically trim swarm connections during power mode changes.
final
backgroundExtensionDuration → Duration
Duration to request for background extension.
final
blockStore → BlockStore?
Optional block store to flush prior to background sleep.
final
currentLifecycleState → NodeLifecycleState
Returns the latest recorded lifecycle state.
no setter
currentPowerMode → IpfsPowerMode
Returns the current power mode.
no setter
flushBlockStoreOnBackground → bool
Whether to flush in-memory blockstore pins to persistent disk before backgrounding.
final
hashCode → int
The hash code for this object.
no setterinherited
isLowBattery → bool
Returns whether the device is currently reported in low battery mode.
no setter
isRunning → bool
Returns whether the coordinator is actively listening to lifecycle events.
no setter
maxBackgroundConnections → int
Target maximum connections in IpfsPowerMode.suspendedMesh.
final
maxForegroundConnections → int
Target maximum connections in IpfsPowerMode.fullActive.
final
maxLowPowerConnections → int
Target maximum connections in IpfsPowerMode.lowPower.
final
networkManager → NetworkManager?
Optional network manager to manage active swarm peer connections.
final
onDetached → Future<void> Function()?
Optional callback triggered when the mobile engine is detached/terminated.
final
onPowerModeChanged → Stream<IpfsPowerMode>
Stream emitting changes to the active IpfsPowerMode.
no setter
pauseReproviderOnBackground → bool
Whether to pause periodic reproviding when the application enters the background.
final
reprovider → Reprovider?
Optional periodic reprovider service to pause/resume.
final
requestBackgroundExtensionOnPause → bool
Whether to request a background execution extension when entering the background.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

handleBatteryState(bool isLow) → Future<void>
Processes an update in device battery state.
handleLifecycleChange(NodeLifecycleState state) → Future<void>
Processes a change in application lifecycle state.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
start() → Future<void>
Starts the service.
stop() → Future<void>
Stops the service.
toString() → String
A string representation of this object.
inherited
transitionTo(IpfsPowerMode targetMode) → Future<void>
Explicitly transitions the coordinator and underlying IPFS node to targetMode.

Operators

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