Open
Description
Starting at Dart 3.x+, we have class modifiers, yay!
I'd like a way to mark an intent to adopt a modifier in a future release, so that:
- The analyzer can issue diagnostics that a to-be-added modifier will become breaking.
- The user can ignore said issue (it's not a release blocker) and attend to it as they prioritize.
As a straw-man, I'd propose adding IntentToAddClassModifier
to package:meta
:
// meta.dart
import 'meta_meta.dart';
/// Annotation marking a class as soon-to-add the equivalent class modifier.
///
/// Tools, such as the analyzer, can provide feedback if
/// - the annotation is associated with anything other than a class
/// - the annotation is associated with a class `C` and the corresponding class modifier would be a static error
@Target({TargetKind.classType})
enum IntentToAddClassModifier {
kAbstract,
kBase,
kFinal,
kInterface,
kSealed,
kMixin,
}
For example, I'd use it here: flutter/flutter#142937.
/cc @pq @srawlins (I wrote this here versus dart-lang/linter
because of the need to re-use analyzer logic for modifiers).