use_raw_strings
Use a raw string to avoid using escapes.
Description
#The analyzer produces this diagnostic when a string literal containing escapes, and no interpolations, could be marked as being raw in order to avoid the need for the escapes.
Example
#The following code produces this diagnostic because the string contains escaped characters that wouldn't need to be escaped if the string is made a raw string:
dart
var s = 'A string with only \\ and \$';
Common fixes
#Mark the string as being raw and remove the unnecessary backslashes:
dart
var s = r'A string with only \ and $';
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。