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:
var s = 'A string with only \\ and \$';
Common fixes
#Mark the string as being raw and remove the unnecessary backslashes:
var s = r'A string with only \ and $';
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.