Dart Analyze logoDart Analyze/
DRT-W1624

Classes and mixins can't implement deferred classes. Classes can't extend deferred classes. Classes can't mixin deferred classesDRT-W1624

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when a type (class or mixin) is a subtype of a class from a library being imported using a deferred import. The supertypes of a type must be compiled at the same time as the type, and classes from deferred libraries aren't compiled until the library is loaded.

For more information, check out Lazily loading a library.

Example

Given a file a.dart that defines the class A:

class A {}

The following code produces this diagnostic because the superclass of B is declared in a deferred library:

import 'a.dart' deferred as a;

class B extends a.A {}

Common fixes

If you need to create a subtype of a type from the deferred library, then remove the deferred keyword:

import 'a.dart' as a;

class B extends a.A {}