目次

avoid_shadowing_type_parameters

型パラメーターのシャドウイングを避けてください。

このルールはDart 2.1から利用可能です。

ルールセット:core推奨flutter

詳細

#

避けるべきこと:型パラメーターのシャドウイング。

悪い例

dart
class A<T> {
  void fn<T>() {}
}

良い例

dart
class A<T> {
  void fn<U>() {}
}

使用方法

#

avoid_shadowing_type_parametersルールを有効にするには、analysis_options.yamlファイルのlinter > rulesセクションにavoid_shadowing_type_parametersを追加します。

analysis_options.yaml
yaml
linter:
  rules:
    - avoid_shadowing_type_parameters