deprecated_subtype_of_function
Extending 'Function' is deprecated.
Implementing 'Function' has no effect.
Mixing in 'Function' is deprecated.
Description
#The analyzer produces this diagnostic when the class Function
is used in
either the extends
, implements
, or with
clause of a class or mixin.
Using the class Function
in this way has no semantic value, so it's
effectively dead code.
Example
#The following code produces this diagnostic because Function
is used as
the superclass of F
:
dart
class F extends Function {}
Common fixes
#Remove the class Function
from whichever clause it's in, and remove the
whole clause if Function
is the only type in the clause:
dart
class F {}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。