build method

  1. @override
String build()
override

Implementation

@override
String build() {
  final ret = <CodeUnit>[];
  ret.add(OneLine(depth: depth, body: 'if (${ifCondition.build()}) {'));
  ret.addAll(ifContent(depth + 1));
  if (elseContent == null) {
    ret.add(OneLine(depth: depth, body: '}'));
    return CodeUnit.join(ret);
  } else {
    ret.add(OneLine(depth: depth, body: '} else {'));
    ret.addAll(elseContent!(depth + 1));
    ret.add(OneLine(depth: depth, body: '}'));
    return CodeUnit.join(ret);
  }
}