目錄

avoid_private_typedef_functions

避免使用私有類型定義函式。

此規則自 Dart 2.0 起可用。

此規則有可用的快速修復

詳細資訊

#

避免僅使用一次的私有類型定義函式。偏好內聯函式語法。

錯誤範例

dart
typedef void _F();
m(_F f);

正確範例

dart
m(void Function() f);

用法

#

若要啟用 avoid_private_typedef_functions 規則,請在您的analysis_options.yaml 檔案的 linter > rules 下新增 avoid_private_typedef_functions

analysis_options.yaml
yaml
linter:
  rules:
    - avoid_private_typedef_functions