getSDKVersion static method

Future<String> getSDKVersion()

Gets the SDK version from the telnyx_webrtc package pubspec.yaml Returns the version string or a fallback version if unable to read

Implementation

static Future<String> getSDKVersion() async {
  if (_sdkVersion != null) return _sdkVersion!;

  try {
    final String pubspecContent = await rootBundle.loadString(
      'packages/telnyx_webrtc/pubspec.yaml',
    );
    final lines = pubspecContent.split('\n');
    for (final line in lines) {
      if (line.startsWith('version:')) {
        final version = line.split(':')[1].trim();
        _sdkVersion = version;
        return _sdkVersion!;
      }
    }
  } catch (e) {
    // Fallback version if we can't read SDK pubspec.yaml
    _sdkVersion = 'unknown';
  }
  return _sdkVersion!;
}