setGlobalOption<T> function

void setGlobalOption<T>(
  1. String name,
  2. T value
)

Implementation

void setGlobalOption<T>(String name, T value) {
  final k = name.toNativeUtf8();
  if (value is String) {
    // T == String
    final v = value.toNativeUtf8();
    Libmdk.instance.MDK_setGlobalOptionString(k.cast(), v.cast());
    malloc.free(v);
  } else if (value is int) {
    Libmdk.instance.MDK_setGlobalOptionInt32(k.cast(), value);
  } else if (value is bool) {
    Libmdk.instance.MDK_setGlobalOptionInt32(k.cast(), value ? 1 : 0);
  } else if (value is LogLevel) {
    Libmdk.instance.MDK_setGlobalOptionInt32(k.cast(), value.rawValue);
  }
  malloc.free(k);
}