Add API to get version information (#2309)

This commit is contained in:
Fangjun Kuang
2025-06-25 00:22:21 +08:00
committed by GitHub
parent 7f2145539d
commit bda427f4b2
169 changed files with 1480 additions and 12 deletions

View File

@@ -0,0 +1,31 @@
// Copyright (c) 2025 Xiaomi Corporation
import 'dart:ffi';
import 'package:ffi/ffi.dart';
import './sherpa_onnx_bindings.dart';
String getVersion() {
Pointer<Utf8> version = SherpaOnnxBindings.getVersionStr?.call() ?? nullptr;
if (version == nullptr) {
return '';
}
return version.toDartString();
}
String getGitSha1() {
Pointer<Utf8> gitSha1 = SherpaOnnxBindings.getGitSha1?.call() ?? nullptr;
if (gitSha1 == nullptr) {
return '';
}
return gitSha1.toDartString();
}
String getGitDate() {
Pointer<Utf8> gitDate = SherpaOnnxBindings.getGitDate?.call() ?? nullptr;
if (gitDate == nullptr) {
return '';
}
return gitDate.toDartString();
}