- Learning Dart
- Ivo Balbaert Dzenan Ridjanovic
- 209字
- 2021-07-19 18:33:42
Documenting your programs
Documenting an application is of utmost importance in software engineering and Dart makes this very easy. The single-line (//
) and multiline comments (/* */
) are useful (for example, to comment out code or mark lines with // TODO
), and they have counterparts ///
and /** */
called documentation comments. In these comments (to be placed on the previous line), you can include references to all kinds of objects in your code (classes, methods, fields, and so on) and the Dartdoc tool (in Dart Editor go to Tools | Generate Dartdoc) will generate HTML documentation where these references become links. To demonstrate we will add docs to our banking example (refer to banking_v2doc.dart
):
/** * A bank account has an [owner], is identified by a [number] * and has an amount of money called [balance]. * The balance is changed through methods [deposit] and [withdraw]. */ class BankAccount { String owner, number; double balance; DateTime dateCreated, dateModified; BankAccount(this.owner, this.number, this.balance) { dateCreated = new DateTime.now(); } /// An amount of money is added to the balance. deposit(double amount) { } /// An amount of money is subtracted from the balance. withdraw(double amount) { } }
This results in the following documentation when viewing banking_v2doc\docs\index.html
in a browser:

- EDA技術與VHDL編程
- Twilio Cookbook
- Hands-On Industrial Internet of Things
- Oracle SOA Suite 11g Performance Tuning Cookbook
- SD-WAN架構與技術(第2版)
- Getting Started with WebRTC
- Building RESTful Web Services with Spring 5(Second Edition)
- 物聯網長距離無線通信技術應用與開發
- 網絡環境中基于用戶視角的信息質量評價研究
- 物聯網與智能家居
- Hands-On Microservices with Node.js
- Cisco無線局域網配置基礎
- INSTANT Social Media Marketing with HootSuite
- Hands-On Microservices:Monitoring and Testing
- Microsoft System Center 2012 Configuration Manager:Administration Cookbook