build method

  1. @override
String build()
override

Implementation

@override
String build() {
  if (commentType == CommentType.commentDoubleBackSlash) {
    return CodeUnit.join(comments
        .map((comment) =>
            OneLine(depth: depth, body: '//$blockContinuationToken$comment'))
        .toList());
  } else if (commentType == CommentType.commentTripleBackSlash) {
    return CodeUnit.join(comments
        .map((comment) =>
            OneLine(depth: depth, body: '///$blockContinuationToken$comment'))
        .toList());
  } else if (commentType == CommentType.commentBlock) {
    return CodeUnit.join([
      OneLine(depth: depth, body: '/*'),
      ...comments
          .map((comment) =>
              OneLine(depth: depth, body: blockContinuationToken + comment))
          .toList(),
      OneLine(depth: depth, body: '*/')
    ]);
  }

  throw UnimplementedError();
}