From c78f3dc44aaa2d59633f2ea330db4766ab1bfe57 Mon Sep 17 00:00:00 2001 From: Bryan Oltman Date: Thu, 25 Apr 2024 12:57:12 -0400 Subject: [PATCH] docs: add long string guidance to Dart style guide (#1970) --- style_guides/dart.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/style_guides/dart.md b/style_guides/dart.md index 270fe753..d11fe5ea 100644 --- a/style_guides/dart.md +++ b/style_guides/dart.md @@ -53,3 +53,17 @@ group('myFunction', () { }); }); ``` + +## PREFER to use multiline string literals for long strings + +This makes the string easier to read, and reduces the chance of accidentally +including too few or too many spaces in the string. + +```dart +// BAD +final longString = 'This is a string longer than the eighty character ' + 'limit that our lint rules enforce.'; + +// GOOD +final longString = '''This is a string longer than the eighty character limit that our lint rules enforce.''' +```