prep method
Prepares batch parameters for processing.
This method extracts items from the shared storage and converts them into a list of parameter maps. Each item becomes a parameter map with a 'value' key.
This follows Python's pattern where prep() returns a list of parameter maps that will be used for batch processing.
Implementation
@override
/// Prepares batch parameters for processing.
///
/// This method extracts items from the shared storage and converts them
/// into a list of parameter maps. Each item becomes a parameter map with
/// a 'value' key.
///
/// This follows Python's pattern where prep() returns a list of parameter
/// maps that will be used for batch processing.
Future<List<Map<String, dynamic>>> prep(Map<String, dynamic> shared) async {
if (!shared.containsKey('items') || shared['items'] is! List) {
throw ArgumentError(
'BatchFlow requires a list of items under the key "items".',
);
}
final items = shared['items'] as List;
return items
.map((item) => {'value': item})
.toList()
.cast<Map<String, dynamic>>();
}