Skip to content

Files

Latest commit

 

History

History
52 lines (40 loc) · 1.1 KB

public_member_api_docs.md

File metadata and controls

52 lines (40 loc) · 1.1 KB

Pattern: Missing documentation for public member

Issue: -

Description

All non-overriding public members should be documented with /// doc-style comments.

Example of correct code:

/// A good thing.
abstract class Good {
 /// Start doing your thing.
 void start() => _start();

 _start();
}

Example of incorrect code:

class Bad {
 void meh() { }
}

In case a public member overrides a member it is up to the declaring member to provide documentation. For example, in the following, Sub needn't document init (though it certainly may, if there's need).

Example of correct code:

/// Base of all things.
abstract class Base {
 /// Initialize the base.
 void init();
}

/// A sub base.
class Sub extends Base {
 @override
 void init() { ... }
}

Note that consistent with dartdoc, an exception to the rule is made when documented getters have corresponding undocumented setters. In this case the setters inherit the docs from the getters.

Further Reading