dart_node_core library

Core JS interop utilities for Dart JS Framework

Classes

Process

A spawned child process with typed streams.

Extensions

NullableExtensions on T?

Extension methods for nullable values enabling pattern matching and functional transformations.

ObjectExtensions on T

Extension methods for non-null values enabling functional transformations.

Constants

defaultRetryPolicy → const ({double backoffMultiplier, int baseDelayMs, int maxAttempts})

Default retry policy: 3 attempts, 50ms base, 2x backoff.

Properties

console JSObject

Get the console object
no setter

require JSFunction

Get Node's require function
no setter

Functions

appendFileSync(String filePath, String data) → void

Append a string to a file synchronously. Creates the file if missing.

consoleError(String message) → void

Log to console.error (stderr)

consoleLog(String message) → void

Log to console (stdout)

dirname(String filePath) String

Get the directory name from a path.

existsSync(String filePath) bool

Check whether a path exists (file or directory).

getGlobal(String name) JSAny?

Get a value from the global JavaScript context

mkdirSync(String dirPath, {bool recursive = false}) → void

Create a directory (and parents) synchronously.

pathJoin(List<String> segments) String

Join path segments using Node.js path.join.

readFileSync(String filePath) String

Read a file synchronously and return its contents as a string.

requireModule(String module) JSAny

Require a Node module

spawn(String command, List<String> args, {bool shell = false}) Process

Spawn a child process.

withRetry<T>(RetryPolicy policy, bool isRetryable(String error), Result<T, String> operation(), {void onRetry(int attempt, String error, int delayMs)?}) Result<T, String>

Execute operation with retry on transient errors.

writeFileSync(String filePath, String data) → void

Write a string to a file synchronously. Overwrites if exists.

Typedefs

RetryPolicy = ({double backoffMultiplier, int baseDelayMs, int maxAttempts})
Retry policy configuration.