initialize static method

void initialize()

Load the shared library and initialize the Dart API DL protocol. Must be called once before any other Appstream method.

Implementation

static void initialize() {
  if (_initialized) return;

  _bindings = AppstreamBindings.load();

  // Pass NativeApi.initializeApiDLData to the C++ side so it can
  // call Dart_PostCObject_DL from any thread.
  final result = _bindings!.init(NativeApi.initializeApiDLData);
  if (result != 0) {
    throw StateError('Failed to initialize Dart API DL (result=$result)');
  }

  _initialized = true;
}