verifyNativeVersion static method

void verifyNativeVersion()

Throws TdVersionMismatchException if the native TDLib isn't the one this package's API was generated for.

Implementation

static void verifyNativeVersion() {
  String option(String name) {
    final value = execute(GetOption(name: name));
    return value is OptionValueString ? value.value : '';
  }

  final version = option('version');
  final commit = option('commit_hash');
  if (version != tdlibVersion ||
      (commit.isNotEmpty && !tdlibCompatibleCommits.contains(commit))) {
    throw TdVersionMismatchException(
      nativeVersion: version,
      nativeCommit: commit,
    );
  }
}