init static method
Configures the single global SDK instance at host bootstrap.
Synchronous from the host's view — it forwards to the native SDK, which
kicks off the init handshake asynchronously off the main thread. Must be
called before any other method. The deployment is build-fixed; the host
supplies no environment. An empty apiKey is misuse: a graceful no-op in
every build, with the cause named on the debug-only guidance log. May be
called before runApp; the plugin initializes Flutter's binding when
needed. Call it in the same zone as runApp; a host that installs a custom
binding must install that binding first.
Implementation
static void init(String apiKey) {
if (_initCalled) {
return;
}
if (apiKey.isEmpty) {
_debugLog('Fireside.init requires a non-empty apiKey');
return;
}
_initCalled = true;
WidgetsFlutterBinding.ensureInitialized();
_initialized = true;
unawaited(
_invokeSetup(
'Fireside.init',
() => _bridge.init(apiKey),
rollbackInit: true,
),
);
}