Dart Analyze logoDart Analyze/
DRT-W1493

Deferred classes can't be used as superclass constraintsDRT-W1493

Major severityMajor
Bug Risk categoryBug Risk

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:

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:

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:

mixin M<T> {}