NSKey.name constructor

NSKey.name(
  1. String tableName,
  2. String name
)

Implementation

factory NSKey.name(String tableName, String name) {
  final table = tableName.toNativeUtf8().cast<Char>();
  final namePtr = name.toNativeUtf8().cast<Char>();
  try {
    final key = nosqueel.ns_key_create_s(table, namePtr);
    if (key == nullptr) {
      throw StateError('ns_key_create_s failed');
    }
    return NSKey._(key);
  } finally {
    calloc.free(table);
    calloc.free(namePtr);
  }
}