サーチ…


構文

  • //一行コメント
  • / *複数行/インラインコメント* /
  • /// Dartdocコメント

備考

コードにコメントを追加して、何かが行われた理由を説明したり、何かが何かを説明したりすることをお勧めします。これにより、コードの将来の読者がコードをより簡単に理解できるようになります。

StackOverflowに関連しないトピック:

行末コメント

同じ行の//の右側にあるすべての行がコメントされます。

int i = 0; // Commented out text

複数行コメント

/**/間にはすべてコメントが付きます。

void main() {
  for (int i = 0; i < 5; i++) {
    /* This is commented, and
    will not affect code */
    print('hello ${i + 1}');
  }   
}

Dartdocを使用したドキュメント

通常のコメントではなくドキュメントコメントを使用すると、 dartdocはそれを見つけてそのドキュメンテーションを生成することができます。

/// The number of characters in this chunk when unsplit.
int get length => ...

あなたは、ほとんどの使用を許可されて値下げに応じて使用してそれを処理するあなたのdocコメントとdartdocに書式設定を値下げパッケージを

/// This is a paragraph of regular text.
///
/// This sentence has *two* _emphasized_ words (i.e. italics) and **two**
/// __strong__ ones (bold).
///
/// A blank line creates another separate paragraph. It has some `inline code`
/// delimited using backticks.
///
/// * Unordered lists.
/// * Look like ASCII bullet lists.
/// * You can also use `-` or `+`.
///
/// Links can be:
///
/// * http://www.just-a-bare-url.com
/// * [with the URL inline](http://google.com)
/// * [or separated out][ref link]
///
/// [ref link]: http://google.com
///
/// # A Header
///
/// ## A subheader


Modified text is an extract of the original Stack Overflow Documentation
ライセンスを受けた CC BY-SA 3.0
所属していない Stack Overflow