SealdAnonymousSdk constructor
Creates a new instance of SealdAnonymousSdk.
apiURL
- The Seald server for this instance to use. This value is given on your Seald dashboard.
appId
- The ID given by the Seald server to your app. This value is given on your Seald dashboard.
logLevel
- The minimum level of logs you want. All logs of this level or above will be displayed. -1
: Trace; 0
: Debug; 1
: Info; 2
: Warn; 3
: Error; 4
: Fatal; 5
: Panic; 6
: NoLevel; 7
: Disabled. Defaults to 0.
logNoColor
- Whether to disable colors in the log output. true
to disable colors, false
to enable colors. Defaults to false.
instanceName
- An arbitrary name to give to this Seald instance. Can be useful for debugging when multiple instances are running in parallel, as it is added to logs. Defaults to an empty string.
{@category SealdAnonymousSdk}
Implementation
SealdAnonymousSdk(
{required String apiURL,
required String appId,
int logLevel = 0,
bool logNoColor = false,
String instanceName = ""}) {
final Pointer<NativeSealdAnonymousInitializeOptions> initOpts =
calloc<NativeSealdAnonymousInitializeOptions>();
final String platform = "c-flutter-anonymous-${Platform.operatingSystem}";
initOpts.ref
..ApiURL = apiURL.toNativeUtf8()
..AppId = appId.toNativeUtf8()
..LogLevel = logLevel
..LogNoColor = logNoColor ? 1 : 0
..InstanceName = instanceName.toNativeUtf8()
..Platform = platform.toNativeUtf8();
final Pointer<Pointer<NativeSealdAnonymousSdk>> result =
calloc<Pointer<NativeSealdAnonymousSdk>>();
_bindings.SealdAnonymousSdk_CreateAnonymousSDK(initOpts, result);
calloc.free(initOpts.ref.ApiURL);
calloc.free(initOpts.ref.AppId);
calloc.free(initOpts.ref.InstanceName);
calloc.free(initOpts.ref.Platform);
calloc.free(initOpts);
_ptr = _TransferablePointer<NativeSealdAnonymousSdk>(result.value);
calloc.free(result);
}