/
githubmirror
/
CS-Notes
Обзор
Документация
Войти
/
githubmirror
/
CS-Notes
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docs/_style/prism-master/examples/prism-dart.html
59 строк
1 KB
CyC2018
use prism-tomorrow.css
19 дек 2018, 09:09
19 дек 2018, 09:09
e9e604e
Код
Авторство
О чём код?
<h2>Comments</h2> <pre><code>// Single line comment /// Documentation single line comment /* Block comment on several lines */ /** Multi-line doc comment */</code></pre> <h2>Annotations</h2> <pre><code>@todo('seth', 'make this do something') @deprecated // Metadata; makes Dart Editor warn about using activate().</code></pre> <h2>Numbers</h2> <pre><code>var x = 1; var hex = 0xDEADBEEF; var bigInt = 346534658346524376592384765923749587398457294759347029438709349347; var y = 1.1; var exponents = 1.42e5; </code></pre> <h2>Strings</h2> <pre><code>var s1 = 'Single quotes work well for string literals.'; var s2 = "Double quotes work just as well."; var s3 = 'It\'s easy to escape the string delimiter.'; var s4 = "It's even easier to just use the other string delimiter."; var s1 = ''' You can create multi-line strings like this one. '''; var s2 = """This is also a multi-line string."""; var s = r"In a raw string, even \n isn't special.";</code></pre> <h2>Full example</h2> <pre><code>class Logger { final String name; bool mute = false; // _cache is library-private, thanks to the _ in front of its name. static final Map<String, Logger> _cache = <String, Logger>{}; factory Logger(String name) { if (_cache.containsKey(name)) { return _cache[name]; } else { final logger = new Logger._internal(name); _cache[name] = logger; return logger; } } Logger._internal(this.name); void log(String msg) { if (!mute) { print(msg); } } }</code></pre>