SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
Dart

Dart static code analysis

Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your DART code

  • All rules 126
  • Vulnerability4
  • Bug15
  • Security Hotspot8
  • Code Smell99
Filtered: 1 rule found
es2015
    Impact
      Clean code attribute
        1. Interpolation should be used instead of String concatenation

           Code Smell

        Interpolation should be used instead of String concatenation

        intentionality - clear
        maintainability
        Code Smell
        • es2015
        • clumsy

        Why is this an issue?

        More Info

        In Dart there’s an ability to use template literals instead of concatenation. Since their use is clearer and more concise, they are preferred.

        Exceptions

        Concatenation of string literals, without any variables, is allowed, both using + and using adjacent strings. Those are typically used for multiline strings.

        Raw string literals are also an exception to this rule, since they don’t support interpolation.

        var s1 =
          'hello\n' +
          'world'; // OK
        var s2 =
          'hello\n'
          'world'; // OK
        var s3 = r'hello\n' + s1; // OK
        

        The multiline strings like s1 and s2 above can also be written as follows:

        var s1Alternative = '''
        hello
        world'''; // OK
        

        Noncompliant code example

        void sayHello(name) {
          print('hello ' + name + '!');  // Noncompliant
        }
        

        Compliant solution

        void sayHello(name) {
          print('hello $name!');
        }
        
          Available In:
        • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories
        • SonarQube ServerAnalyze code in your
          on-premise CI
          Developer Edition
          Available Since
          10.7

        © 2025 SonarSource Sàrl. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use