init static method

void init(
  1. BuildContext context,
  2. String token, [
  3. CuxLogLevel cuxLogLevel = CuxLogLevel.Internal
])

Implementation

static void init(
  BuildContext context,
  String token, [
  CuxLogLevel cuxLogLevel = CuxLogLevel.Internal,
]) {
  WidgetsFlutterBinding.ensureInitialized();
  _singleton._cuxLogLevel = cuxLogLevel;
  _singleton._logger = _CuxLogImpl(_singleton._cuxLogLevel, !kReleaseMode);
  _singleton._logger.logD('CUX initialisation');

  if (!_validateToken(token)) {
    _singleton._logger.logE('CUX initialisation: Invalid token $token');
  }

  final normalizedToken = _normalizeToken(token);

  _singleton._screenshotController = ScreenshotController();
  _singleton._globalCallback = _CuxCallbackImpl(_singleton._logger, context);

  _singleton._sender = _SenderImpl(
      normalizedToken: normalizedToken, logger: _singleton._logger);
  _singleton._sender.init();

  _singleton._startScreenshotTimer();
}