OLD | NEW |
1 Sky Style Guide | 1 Sky Style Guide |
2 =============== | 2 =============== |
3 | 3 |
4 In general, follow our [Design Principles](design.md) for all code. | 4 In general, follow our [Design Principles](design.md) for all code. |
5 | 5 |
6 | 6 |
7 Dart | 7 Dart |
8 ---- | 8 ---- |
9 | 9 |
10 In general, follow the [Dart style | 10 In general, follow the [Dart style |
11 guide](https://www.dartlang.org/articles/style-guide/) for Dart code, | 11 guide](https://www.dartlang.org/articles/style-guide/) for Dart code, |
12 except where that would contradict this page. | 12 except where that would contradict this page. |
13 | 13 |
14 Always use the Dart Analyzer. Do not check in code that increases the | 14 Always use the Dart Analyzer. Do not check in code that increases the |
15 output of the analyzer unless you've filed a bug with the Dart team. | 15 output of the analyzer unless you've filed a bug with the Dart team. |
16 | 16 |
17 Use assert()s liberally. | 17 Use assert()s liberally. |
18 | 18 |
19 | 19 |
20 Types (i.e. classes, typedefs (function signature definitions) and | 20 Types (i.e. classes, typedefs (function signature definitions) and |
21 enums) are named UpperCamelCase. Everything else (methods, fields, | 21 enums) are named UpperCamelCase. Everything else (methods, fields, |
22 variables, constants, enum values, etc) is lowerCamelCase. Global | 22 variables, constants, enum values, etc) is lowerCamelCase. Constant |
23 double and string constants are prefixed with k. Prefer using a static | 23 doubles and strings are prefixed with k. Prefer using a local const |
24 const in a relevant class than using a global constant. | 24 or a static const in a relevant class than using a global constant. |
25 | 25 |
26 Don't name your libraries (no ```library``` keyword). Name the files | 26 Don't name your libraries (no ```library``` keyword). Name the files |
27 in ```lower_under_score.dart``` format. | 27 in ```lower_under_score.dart``` format. |
28 | 28 |
29 | 29 |
30 Class constructors and methods should be ordered in the order that | 30 Class constructors and methods should be ordered in the order that |
31 their members will be used in an instance's typical lifecycle. In | 31 their members will be used in an instance's typical lifecycle. In |
32 particular, this means constructors all come first in class | 32 particular, this means constructors all come first in class |
33 declarations. | 33 declarations. |
34 | 34 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 > ``` | 97 > ``` |
98 | 98 |
99 | 99 |
100 C++ | 100 C++ |
101 --- | 101 --- |
102 | 102 |
103 | 103 |
104 Java | 104 Java |
105 ---- | 105 ---- |
106 | 106 |
OLD | NEW |