Parallel Work
Named durable branches replace graph split/join tokens.
dart
final checks = await flow.parallel(
id: 'checks',
branches: {
'risk': (branch) => branch.serviceTask(riskCheck, order, id: 'risk'),
'credit': (branch) => branch.serviceTask(creditCheck, order, id: 'credit'),
},
);
if (checks['risk']!.rejected || checks['credit']!.rejected) {
return Result.rejected();
}For "first success wins":
dart
final quote = await flow.race(
id: 'quotes',
branches: {
'internal': (branch) => branch.serviceTask(internalQuote, order, id: 'internal'),
'external': (branch) => branch.call(vendorWorkflow, order, id: 'external'),
},
);Loser cancellation commits with the join. A late loser completion is rejected. Use onCancel when a started side effect needs cleanup.