invalid_ non_ virtual_ annotation
Details about the 'invalid_non_virtual_annotation' diagnostic produced by the Dart analyzer.
The annotation '@nonVirtual' can only be applied to a concrete instance member.
Description
#
The analyzer produces this diagnostic when the
nonVirtual annotation is found on a declaration
other than a member of a class, mixin, or enum, or if the
member isn't a concrete instance member.
Examples
#
The following code produces this diagnostic because the method
m is an abstract method:
import 'package:meta/meta.dart';
abstract class C {
@nonVirtual
void m();
}
Common fixes
#If the member is intended to be a concrete instance member, then make it so:
import 'package:meta/meta.dart';
abstract class C {
@nonVirtual
void m() {}
}
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.