create<V, I extends Iterable<V> > static method
CollectiveValue<V>
create<V, I extends Iterable<V> >({
- V? value,
- Cell? bind,
- ContainerType container = ContainerType.growableFalse,
- CollectiveReceptor<
dynamic, Signal, Signal> receptor = CollectiveReceptor.unchanged, - TestCollective<
dynamic, Collective> test = TestCollective.passed, - MapObject? mapObject,
- Synapses<
Signal, Cell> synapses = Synapses.enabled, - bool setter(
- CollectiveValue<
V> value, - I container,
- V? v
- CollectiveValue<
- V? getter(
- CollectiveValue<
V> value, - I container
- CollectiveValue<
override
Factory constructor for full configuration.
Parameters:
value
: Initial valuebind
: Cell to bind tocontainer
: Container type (defaults to ContainerType.value)receptor
: Signal handling configurationtest
: Validation rules- map: Value transformations
synapses
: Connection configurationsetter
: Custom value setter functiongetter
: Custom value getter function
Implementation
static CollectiveValue<V> create<V, I extends Iterable<V>>({
V? value,
Cell? bind,
ContainerType container = ContainerType.growableFalse,
CollectiveReceptor receptor = CollectiveReceptor.unchanged,
TestCollective test = TestCollective.passed,
MapObject? mapObject,
Synapses synapses = Synapses.enabled,
bool Function(CollectiveValue<V> value, I container, V? v)? setter,
V? Function(CollectiveValue<V> value, I container)? getter,
}) {
Record record;
if (test == TestCollective.passed && mapObject == null && synapses == Synapses.enabled) {
if (bind != null || container != ContainerType.growableFalse || receptor != CollectiveReceptor.unchanged) {
record = (
bind: bind,
container: container != ContainerType.growableFalse ? container : ContainerType.create<V,I>(),
receptor: receptor
);
} else {
record = ();
}
} else {
record = (bind: bind,
container: container,
receptor: receptor == CollectiveReceptor.unchanged ? CollectiveReceptor<V,CollectivePost,CollectivePost>() : receptor,
test: test,
mapObject: mapObject,
synapses: synapses, setter: setter, getter: getter
);
}
return _CollectiveValue<V>.fromProperties(CollectiveValueProperties<V>.fromRecord(record), value: value);
}