Open SimonLab opened 3 years ago
@SimonLab good question, thanks for opening this issue. 👍
We should use whatever the "Effective Dart" Linter enforces. e.g: https://dart.dev/guides/language/effective-dart/usage#prefer-using-interpolation-to-compose-strings-and-values (all the examples use single quotes)
And if you really want to be strict, use the "Pedantic" linter: https://pub.dev/packages/pedantic which is what they use at Google.
But yeah, the tl;dr
is: single quotes for strings in Dart
/Flutter
. ✅
to quote something inside string we need to use double quote 'Hello My Name is "Sirajul" ';
You can represent a string with either single quotes or double quotes without any difference.
To escape specific characters in a string use
\
Dart style guide let you decide which one you prefer to use, just be consistent. Flutter style guide recommend to use single quote: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#prefer-single-quotes-for-strings
ref: