create static method

Future<QuicUICodePush> create({
  1. String? configPath,
})

Create QuicUICodePush client from quicui.yaml configuration

This is the primary way to create a QuicUICodePush instance. Configuration is loaded automatically from quicui.yaml.

Throws QuicUIConfigNotFoundException if quicui.yaml is not found. Throws QuicUIConfigInvalidException if configuration is invalid.

Example:

final client = await QuicUICodePush.create();
await client.initialize();

Implementation

static Future<QuicUICodePush> create({String? configPath}) async {
  final yamlConfig = await QuicUIYamlConfig.load(configPath: configPath);

  // Validate API key
  final apiKey = yamlConfig.apiKey ?? _getApiKeyFromEnvironment();
  if (apiKey == null || apiKey.isEmpty) {
    throw QuicUIApiKeyMissingException();
  }

  final config = Config(
    appId: yamlConfig.appId,
    clientSecret: apiKey,
    appVersion: yamlConfig.currentVersion,
    enableDebugLogging: yamlConfig.verbose,
  );

  return QuicUICodePush._(
    serverUrl: yamlConfig.serverUrl,
    apiKey: apiKey,
    config: config,
  );
}