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
 
Tags
    Impact
      Clean code attribute
        1. "mounted" should be checked before using a "BuildContext " after an async operation

           Bug
        2. "void" variables should not be assigned a value

           Bug
        3. Constant patterns should not be used with type literals

           Bug
        4. "is!" should be used instead of "!is"

           Bug
        5. Getters should not be recursive

           Bug
        6. Nullable type parameter values should not be null checked with `!`

           Bug
        7. Regular expressions should be syntactically valid

           Bug
        8. Color definitions should be valid

           Bug
        9. "const" modifier should not be redundant

           Bug
        10. Setters should not declare return types

           Bug
        11. Inappropriate collection calls should not be made

           Bug
        12. Unnecessary equality checks should not be made

           Bug
        13. The original exception object should be rethrown

           Bug
        14. "==" operator and "hashCode()" should be overridden in pairs

           Bug
        15. Jump statements should not occur in "finally" blocks

           Bug

        "is!" should be used instead of "!is"

        intentionality - logical
        reliability
        Bug

          Why is this an issue?

          How can I fix it?

          More Info

          Dart has an is operator to check the type of a variable. This operator can also be used with negation is!. In this case we check that the type of a variable on the left side of the operator is not the one mentioned on the right side.

          Similar operators also exist in other languages, but they might have different spelling. For example, in Kotlin, the same operator is written this way: !is. Developers familiar with both languages might confuse these 2 operators. Unfortunately, this won’t lead to a compile time error, but will change the semantic of your code.

          In Dart, x is! Y, will return true if x is not of type Y and will return false, if x is of type Y. On the other hand x !is Y will apply null assertion operator (!) to x and then return true if x is of type Y, and return false if it is not.

          What is the potential impact?

          It’s hard to estimate the impact taking into account that, firstly x! can throw an exception and then, the resulted check will have an absolutely opposite meaning.

            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

          © 2008-2025 SonarSource SA. All rights reserved.

          Privacy Policy | Cookie Policy | Terms of Use