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
:
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:
class F {}
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.