Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit cd9f1a4

Browse files

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/site/articles/style-guide/index.markdown

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: "Follow these guidelines for consistent, readable Dart code."
77
has-permalinks: true
88
article:
99
written_on: 2011-10-27
10-
updated_on: 2014-10-27
10+
updated_on: 2015-02-17
1111
collection: everyday-dart
1212
---
1313

@@ -18,7 +18,7 @@ article:
1818

1919
<em>Written by Bob Nystrom<br />
2020
<time pubdate date="2011-10-27">October 2011</time>
21-
(updated October 2014)
21+
(updated February 2015)
2222
</em>
2323

2424

@@ -1503,3 +1503,27 @@ var fooList = [1, 2,
15031503
3, 4];
15041504
{% endprettify %}
15051505
</div>
1506+
1507+
1508+
## Strings
1509+
1510+
#### AVOID using curly braces in interpolation when not needed.
1511+
{:.no_toc}
1512+
1513+
If you're just interpolating a simple identifier that's not immediately
1514+
followed by more alphanumeric text, the `{}` can and should be omitted.
1515+
1516+
<div class="good">
1517+
{% prettify dart %}
1518+
'Hi, $name!'
1519+
"Wear your wildest $decade's outfit."
1520+
'Wear your wildest ${decade}s outfit.'
1521+
{% endprettify %}
1522+
</div>
1523+
1524+
<div class="bad">
1525+
{% prettify dart %}
1526+
'Hi, ${name}!'
1527+
"Wear your wildest ${decade}'s outfit."
1528+
{% endprettify %}
1529+
</div>

0 commit comments

Comments
 (0)