initialize method

Future<(bool, InitException?)> initialize({
  1. InitConfig? config,
})

Allows you to initialize FaceSDK.

config - configuration file for FaceSDK initialization.

Returns bool indicating success of initialization and a nullable InitException.

Implementation

Future<(bool success, InitException? error)> initialize({
  InitConfig? config,
}) async {
  var response = await _bridge.invokeMethod("initialize", [config?.toJson()]);

  var jsonObject = _decode(response);
  bool success = jsonObject["success"];
  var error = jsonObject["error"];

  if (success) await _onInit();

  return (success, InitException.fromJson(error));
}