dispatch method
Future<List<NotificationResult> >
dispatch(
- ReleaseEvent event, {
- Map<
String, String> ? env, - bool dryRun = false,
Dispatches event to all configured providers with complete failure isolation.
Implementation
Future<List<NotificationResult>> dispatch(
ReleaseEvent event, {
Map<String, String>? env,
bool dryRun = false,
}) async {
final environment = env ?? Platform.environment;
final payload = NotificationPayload.fromReleaseEvent(event);
final results = <NotificationResult>[];
for (final provider in _providers) {
if (!provider.isConfigured(environment)) {
continue;
}
try {
final result = await provider.send(
payload,
environment: environment,
dryRun: dryRun,
);
results.add(result);
} catch (e) {
// Complete failure isolation — notification error MUST NEVER fail release
results.add(
NotificationResult.failure(
provider.name,
'Unexpected error dispatching notification: $e',
),
);
}
}
return results;
}