update method

Danger<CitrusSymbolRoster<VT>, CitrusSymbolExceptionB> update(
  1. VT value
)

Implementation

Danger<CitrusSymbolRoster<VT>, CitrusSymbolExceptionB> update(VT value) {

    final log = Log(classLocation: runtimeType, functionLocation: 'update');

    // 1.
    final getByPrimaryKeyResult = containsPrimaryKey(value.name);
    log.add(getByPrimaryKeyResult);
    if (getByPrimaryKeyResult.wrapped == false) return Failure(CitrusSymbolExceptionB(), log.monitor({
        'the name': value.name,
        'exists name list': nameList,
    }));

    final List<VT> list = [];

    for (final i in values) {

        if (i.name == value.name) list.add(value);
        else list.add(i);

    }

    final result = CitrusSymbolRoster(list);

    return Success(result, log);

}