currentDartSdkVersion function

String currentDartSdkVersion()

The <major>.<minor>.<patch> Dart SDK version of the running toolchain.

Parsed from Platform.version (e.g. "3.12.2 (stable) (…)""3.12.2"), returning "unknown" when the string is unparseable. This is the second cache-partition segment (see SummaryCacheManager) and the single source of truth for it — SummaryCacheManager and the cache garbage collector both derive the current toolchain's partition from this function.

Implementation

String currentDartSdkVersion() {
  final match = RegExp(r'^(\d+\.\d+\.\d+)').firstMatch(Platform.version);
  return match?.group(1) ?? 'unknown';
}