bloom_server library
Flutter-free server core and HTTP API routing layer for Bloom backend services.
Re-exports bloom_core.dart (environment, DI, logger) alongside HTTP routing primitives
(ApiRouter, BloomRequest, BloomResponse, and BloomMiddleware) from package:bloom_server.
This barrel is strictly Flutter-free, allowing backend services and Server-Side Rendering (SSR)
daemons to compile directly to native binaries (dart compile exe) without the Flutter engine.
Example:
import 'package:bloom_framework/bloom_server.dart';
void main() {
final router = ApiRouter();
router.get('/health', (req) => BloomResponse.json({'status': 'ok'}));
}
Classes
- BloomApiRouter
- High-performance server router for Bloom API routes, WebSocket gateways, and SSR endpoints.
- BloomContainer
- Lightweight, high-performance Dependency Injection container for Bloom.
- BloomCorsMiddleware
- Built-in Cross-Origin Resource Sharing (CORS) middleware for Bloom API endpoints.
- BloomEnv
- Environment configuration parser, store, and type-safe reader.
- BloomLogger
- Standardized structured logging system for Bloom servers, apps, and microservices.
- BloomMiddleware
- Composable middleware interface for Bloom API routes, full-stack SSR servers, and gateways.
- BloomRequest
- Represents an incoming HTTP request in Bloom API routes, SSR endpoints, and middleware.
- BloomResponse
- Represents an HTTP response returned from a Bloom API route handler or middleware.
- BloomRouteGroup
- Represents a scoped route group in BloomApiRouter sharing a URL prefix and middleware pipeline.
-
BloomTestOverride<
T> - Represents a typed test override instance to be injected into a BloomTestScope.
- BloomTestScope
- A scoped DI harness for running unit and integration tests with isolated overrides.
- FunctionalBloomMiddleware
- Function-based middleware implementation wrapping a standalone handler callback.
Enums
- BloomLogLevel
- Log severity levels for Bloom applications.
Properties
- globalContainer → BloomContainer
-
Accesses the global active Bloom DI container.
no setter
- logger → BloomLogger
-
Global standard logger instance for Bloom framework and applications.
final
Functions
-
inject<
T> () → T -
Resolves a dependency of type
Tfrom the global active Bloom container. -
injectOrNull<
T> () → T? -
Resolves an optional dependency of type
Tfrom the global active Bloom container, or returnsnullif not registered. -
provide<
T> (FactoryFunc< T> factory) → void -
Registers a transient
factoryon the global active Bloom container. -
provideSingleton<
T> (FactoryFunc< T> factory, {bool lazy = true}) → void -
Registers a singleton
factoryon the global active Bloom container. -
provideValue<
T> (T value) → void -
Registers an existing instance
valueon the global active Bloom container. -
resetActiveContainer(
) → void - Resets the global active container to a fresh, empty BloomContainer instance.
-
setActiveContainer(
BloomContainer container) → void - Sets the currently active global container (used by BloomTestScope for test isolation).
Typedefs
- BloomLogWriter = void Function(String message)
- Callback signature for handling formatted log line outputs.
-
BloomNextFunction
= Future<
BloomResponse> Function() - Next-handler callback invoked by middleware to pass control to the subsequent middleware or route handler in the pipeline.
-
BloomRouteHandler
= FutureOr<
BloomResponse> Function(BloomRequest request) - Handler function signature for Bloom server route endpoints.
-
FactoryFunc<
T> = T Function() -
Factory function callback that instantiates a dependency of type
T.