Target.fromDartPlatform constructor

Target.fromDartPlatform(
  1. String versionStringFull
)

The Target corresponding the substring of Platform.version describing the Target.

The Platform.version strings are formatted as follows: <version> (<date>) on "<Target>".

Implementation

factory Target.fromDartPlatform(String versionStringFull) {
  final split = versionStringFull.split('"');
  if (split.length < 2) {
    throw FormatException(
        "Unknown version from Platform.version '$versionStringFull'.");
  }
  final versionString = split[1];
  final target = _dartVMstringToTarget[versionString];
  if (target == null) {
    throw FormatException("Unknown ABI '$versionString' from Platform.version"
        " '$versionStringFull'.");
  }
  return target;
}