mixin_on_sealed_class
The class '{0}' shouldn't be used as a mixin constraint because it is sealed, and any class mixing in this mixin must have '{0}' as a superclass.
Description
#The analyzer produces this diagnostic when the superclass constraint of a
mixin is a class from a different package that was marked as
sealed
. Classes that are sealed can't be extended,
implemented, mixed in, or used as a superclass constraint.
Example
#If the package p
defines a sealed class:
dart
import 'package:meta/meta.dart';
@sealed
class C {}
Then, the following code, when in a package other than p
, produces this
diagnostic:
dart
import 'package:p/p.dart';
mixin M on C {}
Common fixes
#除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。