Skip to content

Rule avoid_type_to_string not working #58377

@tomjmech

Description

@tomjmech

The rule avoid_type_to_string is not working for me.

Here are the steps to reproduce:

  1. dart --version
    Dart SDK version: 2.12.3 (stable) (Wed Apr 14 11:02:39 2021 +0200) on "windows_x64"

  2. dart create --template package-simple example_lib

  3. Replace content of analysis_options.yaml with the following:

linter:
  rules:
    avoid_type_to_string: true
  1. Append the following to lib/example_lib.dart:
class A {}

void f() {
  A().runtimeType.toString();
}
  1. dart analyze
    Expected result: a message regarding avoid_type_to_string
    Actual result: no issues found

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.customer-flutterdevexp-linterIssues with the analyzer's support for the linter packagelinter-false-negativeIssues related to lint rules that fail to report a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions