isVersion method

bool isVersion(
  1. String version
)

Whether this is Flutter version: by flutterVersion, or — for an SDK that was never run, so has no version file yet — by its folder's name, as just and fvm name the SDKs they keep (…/3.47.9).

Implementation

bool isVersion(String version) {
  final known = flutterVersion;
  if (known != null) return known == version;
  return root.split('/').where((p) => p.isNotEmpty).lastOrNull == version;
}