WebPlatformService class
Web implementation of PlatformService.
Every call is proxied to a local REST API server at _baseUrl (defaults to
http://localhost:3219). The server is expected to be running alongside
the web frontend — see bin/server.dart.
This file must never import dart:io.
- Implemented types
Constructors
- WebPlatformService({String baseUrl = 'http://localhost:3219', Client? client})
Properties
- currentDirectory → String
-
Current working directory.
no setteroverride
-
environmentVariables
→ Map<
String, String> -
All environment variables.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- homeDirectory → String
-
User home directory (e.g.
/Users/me).no setteroverride - localHostname → String
-
Local hostname.
no setteroverride
- numberOfProcessors → int
-
Number of processors available.
no setteroverride
- operatingSystem → String
-
Operating system identifier (e.g.
macos,linux,windows,web).no setteroverride - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tempDirectory → String
-
System temp directory.
no setteroverride
Methods
-
appendFile(
String path, String content) → Future< void> -
Append
contentto the end of the file atpath.override -
connectWebSocket(
Uri url) → Future< PlatformWebSocket> -
Open a WebSocket connection to
url.override -
copyFile(
String source, String destination) → Future< void> -
Copy a file from
sourcetodestination.override -
createDirectory(
String path, {bool recursive = true}) → Future< void> -
Create a directory at
path.override -
createTempDirectory(
{String? prefix}) → Future< String> -
Create a temporary directory and return its path.
override
-
createTempFile(
{String? prefix, String? suffix}) → Future< String> -
Create a temporary file and return its path.
override
-
deleteDirectory(
String path, {bool recursive = false}) → Future< void> -
Delete the directory at
path. Ifrecursiveis true, delete contents.override -
deleteFile(
String path) → Future< void> -
Delete the file at
path.override -
directoryExists(
String path) → Future< bool> -
Whether a directory exists at
path.override -
fileExists(
String path) → Future< bool> -
Whether a file exists at
path.override -
httpRequest(
String method, Uri url, {Map< String, String> ? headers, Object? body, Duration? timeout}) → Future<PlatformHttpResponse> -
Perform an HTTP request.
override
-
listDirectory(
String path, {bool recursive = false}) → Future< List< String> > -
List entries inside
path. Whenrecursiveis true, descend into sub-directories.override -
moveFile(
String source, String destination) → Future< void> -
Move / rename a file from
sourcetodestination.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readFile(
String path) → Future< String> -
Read file at
pathas a UTF-8 string.override -
readFileBytes(
String path) → Future< Uint8List> -
Read file at
pathas raw bytes.override -
runProcess(
String executable, List< String> arguments, {String? workingDirectory, Map<String, String> ? environment, Duration? timeout, bool runInShell = false}) → Future<ProcessOutput> -
Run a process to completion and capture its output.
override
-
startProcess(
String executable, List< String> arguments, {String? workingDirectory, Map<String, String> ? environment, bool runInShell = false}) → Future<RunningProcess> -
Start a long-running process and return a handle that exposes output
streams and a kill method.
override
-
statFile(
String path) → Future< PlatformFileStat> -
Return metadata for the entity at
path.override -
toString(
) → String -
A string representation of this object.
inherited
-
watchDirectory(
String path, {bool recursive = true}) → Stream< FileChangeEvent> -
Watch
pathfor filesystem changes.override -
writeFile(
String path, String content) → Future< void> -
Write
content(UTF-8) to file atpath, creating parent dirs as needed.override -
writeFileBytes(
String path, Uint8List bytes) → Future< void> -
Write raw
bytesto file atpath, creating parent dirs as needed.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited