fromChainAndTemplateFileSetting static method

Danger<List<TextSymbol>, ChainException> fromChainAndTemplateFileSetting(
  1. Chain chain,
  2. TemplateFileSetting tempalteFileSetting
)

Implementation

static Danger<List<TextSymbol>, ChainException> fromChainAndTemplateFileSetting(Chain chain, TemplateFileSetting tempalteFileSetting) {

    final log = Log(classLocation: TextSymbol, functionLocation: 'fromChainAndTemplateFileSetting');

    final List<TextSymbol> list = [];

    for (final i in tempalteFileSetting.textSymbolNames) {

        final getResult = chain.getOptionAsSingleString(i);
        log.add(getResult);
        if (getResult is! Success<String, ChainExceptionIJK>) return Failure(getResult.asException, log);

        final symbol = TextSymbol.fromPrimitive(i, getResult.wrapped);

        list.add(symbol);

    }

    return Success(list, log);

}