FakePlatform.fromJson constructor

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) {
  final Map<String, dynamic> map =
      const JsonDecoder().convert(json) as Map<String, dynamic>;
  return FakePlatform(
    numberOfProcessors: map['numberOfProcessors'] as int?,
    pathSeparator: map['pathSeparator'] as String?,
    operatingSystem: map['operatingSystem'] as String?,
    operatingSystemVersion: map['operatingSystemVersion'] as String?,
    localHostname: map['localHostname'] as String?,
    environment:
        (map['environment'] as Map<Object?, Object?>).cast<String, String>(),
    executable: map['executable'] as String?,
    resolvedExecutable: map['resolvedExecutable'] as String?,
    script: Uri.parse(map['script'] as String),
    executableArguments:
        (map['executableArguments'] as List<Object?>).cast<String>(),
    packageConfig: map['packageConfig'] as String?,
    version: map['version'] as String?,
    stdinSupportsAnsi: map['stdinSupportsAnsi'] as bool?,
    stdoutSupportsAnsi: map['stdoutSupportsAnsi'] as bool?,
    localeName: map['localeName'] as String?,
  );
}