buildUnit method
Unit
buildUnit(
- Args args
Builds the unit using the factory and applies all arrangements.
Throws a StateError if setUnitFactory has not been called.
@param args The arguments to pass to the unit factory. @return The built and arranged unit.
Implementation
Unit buildUnit(Args args) {
if (_unitFactory == null) throw StateError('Unit factory is not set');
return _unitArrangements.reversed
.fold(_unitFactory!(args), (unit, arrangement) => arrangement(unit));
}