FakePlatform.fromJson constructor Null safety

FakePlatform.fromJson(
  1. String json
)

Creates a new FakePlatform with properties extracted from the encoded JSON string.

json must be a JSON string that matches the encoding produced by toJson.

Implementation

factory FakePlatform.fromJson(String json) {
  Map<String, dynamic> map = JsonDecoder().convert(json);
  return FakePlatform(
    numberOfProcessors: map['numberOfProcessors'],
    pathSeparator: map['pathSeparator'],
    operatingSystem: map['operatingSystem'],
    operatingSystemVersion: map['operatingSystemVersion'],
    localHostname: map['localHostname'],
    environment: map['environment'].cast<String, String>(),
    executable: map['executable'],
    resolvedExecutable: map['resolvedExecutable'],
    script: Uri.parse(map['script']),
    executableArguments: map['executableArguments'].cast<String>(),
    packageConfig: map['packageConfig'],
    version: map['version'],
    stdinSupportsAnsi: map['stdinSupportsAnsi'],
    stdoutSupportsAnsi: map['stdoutSupportsAnsi'],
    localeName: map['localeName'],
  );
}