FakePlatform.fromJson constructor

  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.


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?,
        (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),
        (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?,