NitroConfig class

Global configuration for the Nitro runtime.

Set before calling any Nitro APIs, typically in main():

NitroConfig.instance
  ..debugMode = true
  ..logLevel = NitroLogLevel.verbose;

All settings are live — changing them mid-run takes effect on the next call / stream event.

Properties

debugMode ↔ bool
When true, Nitro emits structured log lines for every bridge invocation, stream event, and lifecycle transition.
getter/setter pair
effectiveLogLevel → NitroLogLevel
Resolved effective log level — respects debugMode override.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isolatePoolSize ↔ int
Deprecated and ignored. The @nitroAsync isolate pool is sized automatically now: it starts with one persistent worker and grows adaptively toward the CPU count as concurrent async calls demand it, and retires the extra workers after an idle period. There is nothing to tune — setting this has no effect.
getter/setter pair
logHandler ↔ void Function(NitroLogLevel level, String tag, String message, [Object? error, StackTrace? stack])
Custom log sink. Replace to integrate with your logger of choice (e.g. package:logging, Crashlytics, etc.).
getter/setter pair
logLevel ↔ NitroLogLevel
Verbosity of the runtime logger.
getter/setter pair
nativeAsyncSpinUs ↔ int?
Spin window in microseconds for a single-in-flight @nitroNativeAsync completion (issue #57), capped — not a fixed spend. When no other native-async call is outstanding, the Dart side busy-polls a shared completion slot before parking on the port; a result that lands inside the window is picked up with no port message and no OS reschedule. Measured lone-call wins: macOS 23 → 4.5 µs, Android 139 → 25 µs.
getter/setter pair
nativeAsyncTimeoutMs ↔ int
Timeout in milliseconds for @nitroNativeAsync calls. When > 0, if the native side fails to post a result within this window (a crashed or buggy native impl), the returned Future completes with a TimeoutException instead of hanging forever, and the underlying ReceivePort + per-call error slot are released. Set to 0 (the default) to wait indefinitely — the native contract is to post exactly one message, so this is opt-in resilience against a misbehaving implementation.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
slowCallThresholdUs ↔ int
Threshold in microseconds above which a NitroRuntime.callAsync call emits a NitroLogLevel.warning log. Set to 0 to disable. Slow-call warning threshold for sync calls, in microseconds; 0 disables.
getter/setter pair
timelineTracingEnabled ↔ bool
When true, NitroRuntime wraps bridge calls in dart:developer timeline spans so DevTools can attribute native bridge cost per method.
getter/setter pair

Methods

disable() → void
Disables all Nitro runtime overhead in one call.
enable({NitroLogLevel level = NitroLogLevel.warning, int slowCallThresholdMs = 16}) → void
Enables Nitro logging in one call.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets all settings to their defaults. Useful in tests.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

instance → NitroConfig
The singleton instance.
final