mixin_super_class_constraint_deferred_class
Deferred classes can't be used as superclass constraints.
Description
#The analyzer produces this diagnostic when a superclass constraint of a mixin is imported from a deferred library.
Example
#The following code produces this diagnostic because the superclass
constraint of math.Random
is imported from a deferred library:
dart
import 'dart:async' deferred as async;
mixin M<T> on async.Stream<T> {}
Common fixes
#If the import doesn't need to be deferred, then remove the deferred
keyword:
dart
import 'dart:async' as async;
mixin M<T> on async.Stream<T> {}
If the import does need to be deferred, then remove the superclass constraint:
dart
mixin M<T> {}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。