initialize static method

Future<void> initialize({
  1. String channel = 'production',
  2. int? currentPatch,
})

Initializes the OTA runtime with active deployment channel and reads the installed patch.

Implementation

static Future<void> initialize({

  String channel = 'production',
  int? currentPatch,
}) async {
  _activeChannel = channel;
  if (currentPatch != null) {
    _currentPatchNumber = currentPatch;
  } else if (_updater.isAvailable) {
    try {
      final patch = await _updater.readCurrentPatch();
      _currentPatchNumber = patch?.number;
    } catch (e) {
      logger.debug('BloomOTA: Could not read installed patch number: $e');
    }
  }

  logger.info('BloomOTA: Initialized on channel "$_activeChannel" (Current patch: ${_currentPatchNumber ?? "base"}) [Shorebird Engine: ${_updater.isAvailable}]');
}