rpc_dart_framework library

Client and server application framework for rpc_dart.

Core building blocks:

  • RpcContainer — type-keyed DI (singleton + factory).
  • RpcEnvConfig — typed, parsed access to environment variables.
  • RpcModule — shared lifecycle base: configure DI, start/stop/health.
  • RpcServerModule — server-side module: buildContracts per connection.
  • RpcIsolateModule — server module variant that runs handlers in a dedicated isolate.
  • RpcApp — application container with signal handling, graceful drain, topological module ordering, health aggregation, and auto-wired error/metrics interceptors. Use RpcApp.server.
  • RpcTestApp — in-memory test harness (no network required).
  • RpcRateLimiter — rate-limiting interceptor (global / per-service / per-method).
  • RateLimit — rate-limit algorithm: RateLimit.slidingWindow or RateLimit.tokenBucket.
  • RpcAppHealth — aggregated health report from RpcApp.health.
  • RpcCallEvent — per-call metrics record emitted by RpcAppConfig.onCall.
  • RpcAppConfig — framework configuration (timeouts, hooks, env override).
  • RpcCallSpy — test interceptor recording all calls.
  • RpcFaultInjector — test interceptor injecting errors and latency.

Classes

RpcApp
The framework entry point.
RpcAppConfig
Framework-level configuration for RpcApp.
RpcAppHealth
Aggregated health report returned by RpcApp.health.
RpcCallEvent
Metadata emitted for every completed RPC call (success or failure).
RpcCallSpy
An IRpcInterceptor that records every RPC call for later inspection.
RpcContainer
Lightweight type-keyed service container.
RpcEnvConfig
Typed, read-only view over environment variables.
RpcFaultInjector
An IRpcInterceptor that injects errors or latency into specific RPC methods.
RpcIsolateModule
A module whose contract handlers run inside a dedicated Dart isolate.
RpcModule
Shared lifecycle base for all framework modules.
RpcServerModule
A module that exposes RPC services on the server side.
RpcSpyEntry
A single recorded RPC call entry produced by RpcCallSpy.
RpcTestApp
In-process test harness for RpcModules.

Enums

RpcAppHealthLevel
Overall health level of the application.

Typedefs

RpcCallObserver = void Function(RpcCallEvent event)
Signature for the per-call metrics observer.
RpcErrorHandler = void Function(Object error, StackTrace stackTrace, String serviceName, String methodName)
Signature for the global error hook.