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> {}
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-05-08. View source or report an issue.