unnecessary_raw_strings
Unnecessary use of a raw string.
Description
#The analyzer produces this diagnostic when a string literal is marked as being raw (is prefixed with an r
), but making the string raw doesn't change the value of the string.
Example
#The following code produces this diagnostic because the string literal will have the same value without the r
as it does with the r
:
dart
var s = r'abc';
Common fixes
#Remove the r
in front of the string literal:
dart
var s = 'abc';
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-05-08. View source or report an issue.