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