initialize static method

Future<bool> initialize({
  1. required Uint8List license,
  2. required AnalyticsService analyticsService,
  3. String? webServiceUrl,
})

Implementation

static Future<bool> initialize({
  required Uint8List license,
  required AnalyticsService analyticsService,
  String? webServiceUrl,
}) async {
  // Create InitConfig with the provided license
  var config = InitConfig(ByteData.view(license.buffer));

  // If webServiceUrl is needed, it might be set here or on the instance.
  // For standard offline usage, it's not typically required.
  // if (webServiceUrl != null) {
  //   DocumentReader.instance.serviceUrl = webServiceUrl; // Hypothetical
  // }

  try {
    var (success, error) = await DocumentReader.instance.initialize(config);
    if (success) {
      await analyticsService.log(
          "DocReaderSDK initialized successfully", AnalyticLevel.info);
      return true;
    } else {
      await analyticsService.recordError(
        error,
        null,
        reason: "DocReaderSDK initialization failed: ${error?.message}",
      );
      return false;
    }
  } catch (e, stack) {
    await analyticsService.recordError(
      e,
      stack,
      reason: "DocReaderSDK initialization exception",
    );
    return false;
  }
}