apiKey property

String? get apiKey

Get API key from C++ state

Implementation

String? get apiKey {
  try {
    final lib = PlatformLoader.loadCommons();
    final getApiKey = lib.lookupFunction<Pointer<Utf8> Function(),
        Pointer<Utf8> Function()>('rac_state_get_api_key');

    final result = getApiKey();
    if (result == nullptr) return null;
    final str = result.toDartString();
    return str.isEmpty ? null : str;
  } catch (e) {
    return null;
  }
}