unnecessary_string_escapes
Unnecessary escape in string literal.
Description
#The analyzer produces this diagnostic when characters in a string are escaped when escaping them is unnecessary.
Example
#The following code produces this diagnostic because single quotes don't need to be escaped inside strings delimited by double quotes:
dart
var s = "Don\'t use a backslash here.";
Common fixes
#Remove the unnecessary backslashes:
dart
var s = "Don't use a backslash here.";
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.