start static method

Future<TdRuntime> start({
  1. String? libraryPath,
  2. int logVerbosityLevel = 1,
  3. bool checkVersion = true,
  4. Duration defaultTimeout = const Duration(seconds: 30),
  5. Iterable<int> staleClientIds = const [],
})

Starts the runtime, or returns the one already running.

  • libraryPath: where libtdjson is; by default libtdjson.so on Android and Linux, tdjson.dll on Windows and the app itself on iOS and macOS (link the library into the app there).
  • logVerbosityLevel: TDLib's internal log level (0 = fatal only, 1 = errors). Higher levels cost CPU and disk.
  • checkVersion: verify the bundled TDLib matches this package's generated API (tdlibVersion / tdlibCompatibleCommits). Turn off only for a custom build whose schema you know matches.
  • staleClientIds: client identifiers from an earlier run of this process to close before starting (see liveClientIds).

Implementation

static Future<TdRuntime> start({
  String? libraryPath,
  int logVerbosityLevel = 1,
  bool checkVersion = true,
  Duration defaultTimeout = const Duration(seconds: 30),
  Iterable<int> staleClientIds = const [],
}) {
  final running = _instance;
  if (running != null && !running._closed) return Future.value(running);
  return _starting ??= _start(
    libraryPath: libraryPath,
    logVerbosityLevel: logVerbosityLevel,
    checkVersion: checkVersion,
    defaultTimeout: defaultTimeout,
    staleClientIds: staleClientIds,
  ).whenComplete(() => _starting = null);
}